Hi!
THX, Skyline!
On chart we have bid prices. When do we buy, when our bid price hits the entry or our ask price?
We do it one each hour or as many time the price hits our entry levels within that hour?
META TRADER 4 THREAD NOW ON KRESLIK.COM
Moderator: moderators
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:
Re: TRO BUY ZONE WITH HISTORY
Skyline wrote:Hi TRO,
this version of your TRO BUY ZONE will work fine on every timeframe lower than H1 and show also the lines on history chart.
Hope you like itCode: Select all
//+------------------------------------------------------------------+
//| TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#property copyright "Skyline,2008"
#property link "www.forexpertutti.it"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 White
#property indicator_color2 Blue
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Red
double OpenLine[];
double BuyLine1[];
double BuyLine2[];
double SellLine1[];
double SellLine2[];
//+------------------------------------------------------------------+
//| 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,BuyLine2);
SetIndexStyle(3,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(3,SellLine1);
SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(4,SellLine2);
// SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4);
// SetIndexBuffer(1,ShortBuffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
//----
//---- 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+3*Point;
BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-3*Point;
SellLine2[i] = OpenH1-4*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Thanks... I learned a new trick.
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.
Re: TRO BUY ZONE WITH HISTORY
TheRumpledOne wrote:Skyline wrote:Hi TRO,
this version of your TRO BUY ZONE will work fine on every timeframe lower than H1 and show also the lines on history chart.
Hope you like itCode: Select all
//+------------------------------------------------------------------+
//| TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#property copyright "Skyline,2008"
#property link "www.forexpertutti.it"
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 White
#property indicator_color2 Blue
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Red
double OpenLine[];
double BuyLine1[];
double BuyLine2[];
double SellLine1[];
double SellLine2[];
//+------------------------------------------------------------------+
//| 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,BuyLine2);
SetIndexStyle(3,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(3,SellLine1);
SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(4,SellLine2);
// SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,4);
// SetIndexBuffer(1,ShortBuffer);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
//----
//---- 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+3*Point;
BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-3*Point;
SellLine2[i] = OpenH1-4*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Thanks... I learned a new trick.
You're welcome TRO
And this is another version with the green profit target set at 10 pips from open price
So basically for the Buy Zone method you enter whenever the price enter the related zone with a fixed sl of 5/7 pips and exit at profit target line ?
So basically for the Buy Zone method you enter whenever the price enter the related zone with a fixed sl of 5/7 pips and exit at profit target line ?
Code: Select all
//+------------------------------------------------------------------+
//| TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#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 Blue
#property indicator_color4 Red
#property indicator_color5 Red
#property indicator_color6 Green
#property indicator_color7 Green
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,BuyLine2);
SetIndexStyle(3,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(3,SellLine1);
SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(4,SellLine2);
SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(5,TargetLine1);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(6,TargetLine2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit;
//----
//---- 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+3*Point;
BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-3*Point;
SellLine2[i] = OpenH1-4*Point;
TargetLine1[i] = OpenH1+10*Point;
TargetLine2[i] = OpenH1-10*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
- 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:
Hey Skyline:
I made a slight mod to your code... I added user inputs so they can change the targets and I there is just one entry trigger line instead of 2
Code: Select all
//+------------------------------------------------------------------+
//| _BZ_SKYLINE TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#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 Blue
#property indicator_color3 Red
//#property indicator_color5 Red
#property indicator_color4 LimeGreen
#property indicator_color5 LimeGreen
extern double myEntryTrigger = 4 ;
extern double myProfitTarget = 6 ;
extern double myStopLoss = 7 ;
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,BuyLine2);
SetIndexStyle(2,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(2,SellLine1);
// SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
// SetIndexBuffer(4,SellLine2);
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;
//----
//---- 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;
// BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-myEntryTrigger*Point;
// SellLine2[i] = OpenH1-4*Point;
TargetLine1[i] = OpenH1+myProfitTarget*Point;
TargetLine2[i] = OpenH1-myProfitTarget*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
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:
- 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:
I added the vertical hour line.
Code: Select all
//+------------------------------------------------------------------+
//| _BZ_SKYLINE TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#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 Blue
#property indicator_color3 Red
//#property indicator_color5 Red
#property indicator_color4 LimeGreen
#property indicator_color5 LimeGreen
extern double myEntryTrigger = 4 ;
extern double myProfitTarget = 6 ;
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,BuyLine2);
SetIndexStyle(2,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(2,SellLine1);
// SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
// SetIndexBuffer(4,SellLine2);
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;
// BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-myEntryTrigger*Point;
// SellLine2[i] = OpenH1-4*Point;
TargetLine1[i] = OpenH1+myProfitTarget*Point;
TargetLine2[i] = OpenH1-myProfitTarget*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
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);
}
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.
- JoeSDF
- rank: <50 posts
- Posts: 1
- Joined: Wed Jan 09, 2008 6:28 pm
- Reputation: 0
- Location: Louisville, KY
- Gender:
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
Best regards,
Joe SDF
-
- rank: <50 posts
- Posts: 7
- Joined: Sat Dec 02, 2006 12:25 pm
- Reputation: 0
- Gender:
Please post the indicator
Could you please post the indicator, when i copy,paste the code
I dont get it to work nor can I compile it,
or i am doing something stupid
I dont get it to work nor can I compile it,
or i am doing something stupid
TheRumpledOne wrote:
I added the vertical hour line.Code: Select all
//+------------------------------------------------------------------+
//| _BZ_SKYLINE TRO BUY ZONE .mq4 |
//| Skyline,2008 |
//| |
//+------------------------------------------------------------------+
#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 Blue
#property indicator_color3 Red
//#property indicator_color5 Red
#property indicator_color4 LimeGreen
#property indicator_color5 LimeGreen
extern double myEntryTrigger = 4 ;
extern double myProfitTarget = 6 ;
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,BuyLine2);
SetIndexStyle(2,DRAW_LINE,STYLE_DASH);
SetIndexBuffer(2,SellLine1);
// SetIndexStyle(4,DRAW_LINE,STYLE_DASH);
// SetIndexBuffer(4,SellLine2);
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;
// BuyLine2[i] = OpenH1+4*Point;
SellLine1[i] = OpenH1-myEntryTrigger*Point;
// SellLine2[i] = OpenH1-4*Point;
TargetLine1[i] = OpenH1+myProfitTarget*Point;
TargetLine2[i] = OpenH1-myProfitTarget*Point;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
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);
}
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.