META TRADER 4 THREAD NOW ON KRESLIK.COM
Moderator: moderators
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
FREE MT4 BUY ZONE INDICATOR ATTACHED[U]
- Attachments
-
- BZ_skyline.zip
- (4.4 KiB) Downloaded 497 times
Last edited by TheRumpledOne on Thu Jan 31, 2008 2:56 am, edited 1 time in total.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!
Please do NOT PM me with trading or coding questions, post them in a thread.
Please do NOT PM me with trading or coding questions, post them in a thread.
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
JoeSDF wrote:TRO / Skyline - I really like the changes you two have made. When I copy and paste TRO's above code somehow I've lost the Buy Zone numbers which usually show in the upper right-hand corner of my chart. Is there any way to get this back? The RANGE numbers show OK because it's a separate indicator. Also might we have separate external inputs for the Buy Zone so it appears correct when I use this on the Cable? Nice work guys.
Best regards,
Joe SDF
That's a different BuyZone indicator.
IT'S NOT WHAT YOU TRADE, IT'S HOW YOU TRADE IT!
Please do NOT PM me with trading or coding questions, post them in a thread.
Please do NOT PM me with trading or coding questions, post them in a thread.
-
- rank: <50 posts
- Posts: 7
- Joined: Sat Dec 02, 2006 12:25 pm
- Reputation: 0
- Gender:
Thank you
Thank you Tro for all your help and all the indicators you have made
TheRumpledOne wrote:Here you go.
More cosmetics ....
Code: Select all
//+------------------------------------------------------------------+
//| _BZ_Skyline.mq4 |
//| Skyline, 2008 |
//| http://www.forexpertutti.it |
//+------------------------------------------------------------------+
#property copyright "Skyline,2008"
#property link "www.forexpertutti.it"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 White
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 LimeGreen
#property indicator_color5 LimeGreen
extern double myEntryTrigger = 4 ;
extern double myProfitTarget = 10 ;
extern double myStopLoss = 7 ;
extern color myHourColor = DarkGray ;
extern int myStyle = STYLE_DOT;
double OpenLine[];
double BuyLine1[];
double BuyLine2[];
double SellLine1[];
double SellLine2[];
double TargetLine1[];
double TargetLine2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(0,OpenLine);
SetIndexStyle(1,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(1,BuyLine1);
SetIndexStyle(2,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(2,SellLine1);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(3,TargetLine1);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(4,TargetLine2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
//----
if( TimeHour(Time[0] ) != TimeHour(Time[1]) )
{
double level= (High[1] + Low[1] + Close[1]) / 3;
SetTimeLine("HourStart", "Hour", 0, White, level+10*Point); // draw the vertical bars that marks the time span
}
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (int i=0; i<limit; i++)
{
int BarShift = iBarShift(NULL,PERIOD_H1,Time[i],true);
double OpenH1 = iOpen(NULL,PERIOD_H1,BarShift);
OpenLine[i] = OpenH1;
BuyLine1[i] = OpenH1+myEntryTrigger*Point;
SellLine1[i] = OpenH1-myEntryTrigger*Point;
TargetLine1[i] = OpenH1+myProfitTarget*Point;
TargetLine2[i] = OpenH1-myProfitTarget*Point;
}
//----
DisplayText();
return(0);
}
void DisplayText()
{
double OpenH1 = iOpen(NULL,PERIOD_H1,0);
ObjectDelete("OpenText");
ObjectDelete("SellEntry");
ObjectDelete("BuyEntry");
ObjectDelete("ProfitTarget1");
ObjectDelete("ProfitTarget2");
// Text for Open Price
ObjectCreate("OpenText",OBJ_TEXT,0,Time[0],OpenH1);
ObjectSetText("OpenText","Open price",8,"Verdana",White);
// Text for Sell Entry
ObjectCreate("SellEntry",OBJ_TEXT,0,Time[0],OpenH1-myEntryTrigger*Point);
ObjectSetText("SellEntry","Sell entry",8,"Verdana",Red);
// Text for Buy Entry
ObjectCreate("BuyEntry",OBJ_TEXT,0,Time[0],OpenH1+myEntryTrigger*Point);
ObjectSetText("BuyEntry","Buy entry",8,"Verdana",Blue);
// Text for ProfitTarget1
ObjectCreate("ProfitTarget1",OBJ_TEXT,0,Time[0],OpenH1+myProfitTarget*Point);
ObjectSetText("ProfitTarget1","Profit Target (BUY)",8,"Verdana",Green);
// Text for ProfitTarget2
ObjectCreate("ProfitTarget2",OBJ_TEXT,0,Time[0],OpenH1-myProfitTarget*Point);
ObjectSetText("ProfitTarget2","Profit Target (SELL)",8,"Verdana",Green);
}
//+------------------------------------------------------------------+
void SetTimeLine(string objname, string text, int idx, color col1, double vleveltext)
{
string name= "[PIVOT] " + objname;
int x= Time[idx];
if (ObjectFind(name) != 0)
ObjectCreate(name, OBJ_TREND, 0, x, 0, x, 100);
else {
ObjectMove(name, 0, x, 0);
ObjectMove(name, 1, x, 100);
}
ObjectSet(name, OBJPROP_STYLE, myStyle);
ObjectSet(name, OBJPROP_COLOR, myHourColor);
if (ObjectFind(name + " Label") != 0)
ObjectCreate(name + " Label", OBJ_TEXT, 0, x, vleveltext);
else
ObjectMove(name + " Label", 0, x, vleveltext);
ObjectSetText(name + " Label", text, 8, "Arial", col1);
}
- Attachments
-
- uj.jpg (62.17 KiB) Viewed 3709 times
Last edited by Skyline on Tue Jan 15, 2008 11:44 am, edited 1 time in total.
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
TRO too much funny this language isn't it ? ... lol
Added Suggested TP and Pips available for the TRO RANGE indicator , I guess this information could be useful , do you agree TRO ?
Suggested TP is difference between average price pips minus bufferpips (8 pips for BUYZONE) divided by 2 , thus it's indicate how much pips above/below entry point we could expect.
Pips Available is the difference from the average range pips minus the current range pips , thus it should indicate how much potential pips we could expect above current high/low.
Code: Select all
//+------------------------------------------------------------------+
//| _TRO_RANGE_EZ_P |
//| |
//| Copyright ? 2008, Avery T. Horton, Jr. aka TheRumpledOne |
//| |
//| PO BOX 43575, TUCSON, AZ 85733 |
//| |
//| GIFTS AND DONATIONS ACCEPTED |
//| |
//| therumpldone@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2008, Avery T. Horton, Jr. aka TRO"
#property link "http://www.therumpldone.com/"
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_minimum 0
#property indicator_maximum 1
//---- indicator parameters
//extern int Threshold = 20;
extern int win = 0;
extern int price.x.offset= 350;//250
extern int price.y.offset= -140;//-160
extern int Chart_Period = PERIOD_H1;
extern int MaxBars = 24;
extern color CurrentBarColor = LightGray ;
extern color ThresholdColor = Red;
extern color BufferPips = 8;
//---- indicator buffers
double MaxRange = 0 ;
double MinRange = 0 ;
double AvgRange = 0 ;
double xRange = 0 ;
double tRange = 0 ;
//---- buffers
double zRANGE = 0;
bool show.info = true;
bool ShowChart = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
int deinit()
{
ObjectDelete("RNG430");
ObjectDelete("RNG429");
ObjectDelete("RNG429B");
ObjectDelete("RNG431");
ObjectDelete("RNG432");
ObjectDelete("RNG434");
ObjectDelete("RNG435");
ObjectDelete("RNG436");
ObjectDelete("RNG437");
ObjectDelete("RNG438");
}
//+------------------------------------------------------------------+
//| Range |
//+------------------------------------------------------------------+
int start()
{
MaxRange = 0 ;
MinRange = 999999 ;
double HighVal,LowVal;
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
if(counted_bars<0) return(-1);
limit = MaxBars ;
//---- RANGE counted in the 1-st buffer
double buf_tmp = 0 ;
int z = 0 ;
for(int i=0; i<limit; i++)
{
HighVal = iHigh(NULL,Chart_Period,i);
LowVal = iLow(NULL,Chart_Period,i);
xRange = HighVal - LowVal ; // range
tRange = xRange / Point; // range
buf_tmp = buf_tmp + xRange ;
if( tRange > MaxRange ) {MaxRange = tRange ; }
if( tRange < MinRange ) {MinRange = tRange ; }
}
AvgRange = buf_tmp / MaxBars /Point ; // average range
zRANGE = (iHigh(NULL,Chart_Period,0)-iLow(NULL,Chart_Period,0))/Point ;
double MaxSuggestedTP = (AvgRange-BufferPips)/2;
double PipsAvailable = (AvgRange-zRANGE);
//}
//+------------------------------------------------------------------+
//void DoShowInfo()
//{
string tPeriod = " "+TimeFrameToString( Chart_Period ) ;
if ( zRANGE > AvgRange ) { color RangeColor = ThresholdColor ; } else { RangeColor = CurrentBarColor ; }
ObjectCreate("RNG430", OBJ_LABEL, win, 0, 0);//HiLow LABEL
ObjectSetText("RNG430","RANGE", 30, "Arial Bold", Gray);
ObjectSet("RNG430", OBJPROP_CORNER, 0);
ObjectSet("RNG430", OBJPROP_XDISTANCE, 760+price.x.offset);
ObjectSet("RNG430", OBJPROP_YDISTANCE, 160+price.y.offset);
ObjectCreate("RNG429", OBJ_LABEL, win, 0, 0);//HiLow LABEL
ObjectSetText("RNG429",DoubleToStr(MaxRange,0), 15, "Arial Bold", Lime);
ObjectSet("RNG429", OBJPROP_CORNER, 0);
ObjectSet("RNG429", OBJPROP_XDISTANCE, 770+price.x.offset);
ObjectSet("RNG429", OBJPROP_YDISTANCE, 197+price.y.offset);
ObjectCreate("RNG429b", OBJ_LABEL, win, 0, 0);//HiLow LABEL
ObjectSetText("RNG429b",DoubleToStr( MinRange ,0), 15, "Arial Bold", Crimson);
ObjectSet("RNG429b", OBJPROP_CORNER, 0);
ObjectSet("RNG429b", OBJPROP_XDISTANCE, 770+price.x.offset);
ObjectSet("RNG429b", OBJPROP_YDISTANCE, 260+price.y.offset);
ObjectCreate("RNG431", OBJ_LABEL, win, 0, 0);//HiLow LABEL
ObjectSetText("RNG431",DoubleToStr(zRANGE,0)+tPeriod, 40, "Arial Bold", RangeColor );
ObjectSet("RNG431", OBJPROP_CORNER, 0);
ObjectSet("RNG431", OBJPROP_XDISTANCE, 800+price.x.offset); // 765
ObjectSet("RNG431", OBJPROP_YDISTANCE, 210+price.y.offset);
ObjectCreate("RNG432", OBJ_LABEL, win, 0, 0); //
ObjectSetText("RNG432",DoubleToStr( AvgRange ,2), 15, "Arial Bold", Orange); // RANGEBuffer2[0] buf0[0]
ObjectSet("RNG432", OBJPROP_CORNER, 0);
ObjectSet("RNG432", OBJPROP_XDISTANCE, 860+price.x.offset);
ObjectSet("RNG432", OBJPROP_YDISTANCE, 197+price.y.offset);
ObjectCreate("RNG434", OBJ_LABEL, win, 0, 0);
ObjectSetText("RNG434",DoubleToStr( MaxBars ,0), 15, "Arial Bold", Silver);
ObjectSet("RNG434", OBJPROP_CORNER, 0);
ObjectSet("RNG434", OBJPROP_XDISTANCE, 860+price.x.offset);
ObjectSet("RNG434", OBJPROP_YDISTANCE, 260+price.y.offset);
ObjectCreate("RNG435", OBJ_LABEL, win, 0, 0);
ObjectSetText("RNG435","Suggested TP", 11, "Arial Bold", Orange);
ObjectSet("RNG435", OBJPROP_CORNER, 0);
ObjectSet("RNG435", OBJPROP_XDISTANCE, 760+price.x.offset);
ObjectSet("RNG435", OBJPROP_YDISTANCE, 300+price.y.offset);
ObjectCreate("RNG436", OBJ_LABEL, win, 0, 0);
ObjectSetText("RNG436"," < "+DoubleToStr( MaxSuggestedTP ,1 ), 11, "Arial Bold", Orange);
ObjectSet("RNG436", OBJPROP_CORNER, 0);
ObjectSet("RNG436", OBJPROP_XDISTANCE, 860+price.x.offset);
ObjectSet("RNG436", OBJPROP_YDISTANCE, 300+price.y.offset);
ObjectCreate("RNG437", OBJ_LABEL, win, 0, 0);
ObjectSetText("RNG437","Pips Available", 11, "Arial Bold", Aqua);
ObjectSet("RNG437", OBJPROP_CORNER, 0);
ObjectSet("RNG437", OBJPROP_XDISTANCE, 760+price.x.offset);
ObjectSet("RNG437", OBJPROP_YDISTANCE, 320+price.y.offset);
ObjectCreate("RNG438", OBJ_LABEL, win, 0, 0);
ObjectSetText("RNG438",DoubleToStr( PipsAvailable ,1 ), 11, "Arial Bold", Aqua);
ObjectSet("RNG438", OBJPROP_CORNER, 0);
ObjectSet("RNG438", OBJPROP_XDISTANCE, 860+price.x.offset);
ObjectSet("RNG438", OBJPROP_YDISTANCE, 320+price.y.offset);
WindowRedraw();
return(0);
}
//+------------------------------------------------------------------+
string TimeFrameToString(int tf)
{
string tfs;
switch(tf) {
case PERIOD_M1: tfs="M1" ; break;
case PERIOD_M5: tfs="M5" ; break;
case PERIOD_M15: tfs="M15" ; break;
case PERIOD_M30: tfs="M30" ; break;
case PERIOD_H1: tfs="H1" ; break;
case PERIOD_H4: tfs="H4" ; break;
case PERIOD_D1: tfs="D1" ; break;
case PERIOD_W1: tfs="W1" ; break;
case PERIOD_MN1: tfs="MN1";
}
return(tfs);
}
//+------------------------------------------------------------------+
Added Suggested TP and Pips available for the TRO RANGE indicator , I guess this information could be useful , do you agree TRO ?
Suggested TP is difference between average price pips minus bufferpips (8 pips for BUYZONE) divided by 2 , thus it's indicate how much pips above/below entry point we could expect.
Pips Available is the difference from the average range pips minus the current range pips , thus it should indicate how much potential pips we could expect above current high/low.
ahhhhhh I cannot stop ehehhe
Added some other cosmetics to the BZ_Skyline indicator (price showed on lines)
Added some other cosmetics to the BZ_Skyline indicator (price showed on lines)
Code: Select all
//+------------------------------------------------------------------+
//| _BZ_Skyline.mq4 |
//| Skyline, 2008 |
//| http://www.forexpertutti.it |
//+------------------------------------------------------------------+
#property copyright "Skyline,2008"
#property link "www.forexpertutti.it"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 White
#property indicator_color2 Aqua
#property indicator_color3 Red
#property indicator_color4 LimeGreen
#property indicator_color5 LimeGreen
extern double myEntryTrigger = 4 ;
extern double myProfitTarget = 10 ;
extern double myStopLoss = 7 ;
extern color myHourColor = DarkGray ;
extern int myStyle = STYLE_SOLID;
double OpenLine[];
double BuyLine1[];
double BuyLine2[];
double SellLine1[];
double SellLine2[];
double TargetLine1[];
double TargetLine2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(0,OpenLine);
SetIndexStyle(1,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(1,BuyLine1);
SetIndexStyle(2,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(2,SellLine1);
SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(3,TargetLine1);
SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(4,TargetLine2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
//----
if( TimeHour(Time[0] ) != TimeHour(Time[1]) )
{
double level= (High[1] + Low[1] + Close[1]) / 3;
SetTimeLine("HourStart", "Hour", 0, White, level+10*Point); // draw the vertical bars that marks the time span
}
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (int i=0; i<limit; i++)
{
int BarShift = iBarShift(NULL,PERIOD_H1,Time[i],true);
double OpenH1 = iOpen(NULL,PERIOD_H1,BarShift);
OpenLine[i] = OpenH1;
BuyLine1[i] = OpenH1+myEntryTrigger*Point;
SellLine1[i] = OpenH1-myEntryTrigger*Point;
TargetLine1[i] = OpenH1+myProfitTarget*Point;
TargetLine2[i] = OpenH1-myProfitTarget*Point;
}
//----
DisplayText();
return(0);
}
void DisplayText()
{
double OpenH1 = iOpen(NULL,PERIOD_H1,0);
// Text for Open Price
ObjectDelete("OpenText");
ObjectDelete("SellEntry");
ObjectDelete("BuyEntry");
ObjectDelete("ProfitTarget1");
ObjectDelete("ProfitTarget2");
ObjectCreate("OpenText",OBJ_TEXT,0,Time[0],OpenH1);
ObjectSetText("OpenText","Open price - "+DoubleToStr(OpenH1,Digits),8,"Verdana",White);
// Text for Sell Entry
ObjectCreate("SellEntry",OBJ_TEXT,0,Time[0],OpenH1-myEntryTrigger*Point);
ObjectSetText("SellEntry","Sell entry - "+DoubleToStr(OpenH1-myEntryTrigger*Point,Digits),8,"Verdana",Red);
// Text for Buy Entry
ObjectCreate("BuyEntry",OBJ_TEXT,0,Time[0],OpenH1+myEntryTrigger*Point);
ObjectSetText("BuyEntry","Buy entry - "+DoubleToStr(OpenH1+myEntryTrigger*Point,Digits),8,"Verdana",Aqua);
// Text for ProfitTarget1
ObjectCreate("ProfitTarget1",OBJ_TEXT,0,Time[0],OpenH1+myProfitTarget*Point);
ObjectSetText("ProfitTarget1","Buy exit - "+DoubleToStr(OpenH1+myProfitTarget*Point,Digits),8,"Verdana",LimeGreen);
// Text for ProfitTarget2
ObjectCreate("ProfitTarget2",OBJ_TEXT,0,Time[0],OpenH1-myProfitTarget*Point);
ObjectSetText("ProfitTarget2","Sell exit - "+DoubleToStr(OpenH1-myProfitTarget*Point,Digits),8,"Verdana",LimeGreen);
}
//+------------------------------------------------------------------+
void SetTimeLine(string objname, string text, int idx, color col1, double vleveltext)
{
string name= "[PIVOT] " + objname;
int x= Time[idx];
if (ObjectFind(name) != 0)
ObjectCreate(name, OBJ_TREND, 0, x, 0, x, 100);
else {
ObjectMove(name, 0, x, 0);
ObjectMove(name, 1, x, 100);
}
ObjectSet(name, OBJPROP_STYLE, myStyle);
ObjectSet(name, OBJPROP_COLOR, myHourColor);
if (ObjectFind(name + " Label") != 0)
ObjectCreate(name + " Label", OBJ_TEXT, 0, x, vleveltext);
else
ObjectMove(name + " Label", 0, x, vleveltext);
ObjectSetText(name + " Label", text, 8, "Arial", col1);
}
- TheRumpledOne
- rank: 10000+ posts
- Posts: 15562
- Joined: Sun May 14, 2006 9:31 pm
- Reputation: 3036
- Location: Oregon
- Real name: Avery T. Horton, Jr.
- Gender:
- Contact:
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.