META TRADER 4 THREAD NOW ON KRESLIK.COM

Moderator: moderators

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 12778
Joined: Sun May 14, 2006 9:31 pm
Reputation: 1332
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sun Jan 13, 2008 12:18 am

marc wrote:
TheRumpledOne wrote:Image


Latest version.


Hi!

The Rumpled One, you are amazing. I do not know how I should show you my gratitude.

Could you post the template you use for your above chart?

I've downloaded all your files and I do not get to match yours.

THX

Marc


Remember, I am still a MT4 Newbie.

My templates don't seem to work when I use them on different computers.

That's why I haven't been uploading templates.

Give me some time to learn the ropes!
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 add www.kreslik.com to your ad blocker white list.
Thank you for your support.

Skyline
rank: <50 posts
rank: <50 posts
Posts: 39
Joined: Tue Jan 16, 2007 1:27 pm
Reputation: 0
Gender: Male
Contact:

TRO BUY ZONE WITH HISTORY

Postby Skyline » Sun Jan 13, 2008 10:39 am

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 it ;)

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 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);
  }
//+------------------------------------------------------------------+
Attachments
usdjpy-m5.jpg
usdjpy-m5.jpg (46.64 KiB) Viewed 973 times

marc
rank: <50 posts
rank: <50 posts
Posts: 11
Joined: Sat Jan 12, 2008 8:55 pm
Reputation: 0
Gender: Male

Postby marc » Sun Jan 13, 2008 10:58 am

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?

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 12778
Joined: Sun May 14, 2006 9:31 pm
Reputation: 1332
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Re: TRO BUY ZONE WITH HISTORY

Postby TheRumpledOne » Sun Jan 13, 2008 3:25 pm

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 it ;)

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 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.

Skyline
rank: <50 posts
rank: <50 posts
Posts: 39
Joined: Tue Jan 16, 2007 1:27 pm
Reputation: 0
Gender: Male
Contact:

Re: TRO BUY ZONE WITH HISTORY

Postby Skyline » Sun Jan 13, 2008 4:10 pm

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 it ;)

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 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 ;)

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

Skyline
rank: <50 posts
rank: <50 posts
Posts: 39
Joined: Tue Jan 16, 2007 1:27 pm
Reputation: 0
Gender: Male
Contact:

Postby Skyline » Sun Jan 13, 2008 4:13 pm

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 ?

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);
  }
//+------------------------------------------------------------------+

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 12778
Joined: Sun May 14, 2006 9:31 pm
Reputation: 1332
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sun Jan 13, 2008 4:47 pm

Image

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.

Skyline
rank: <50 posts
rank: <50 posts
Posts: 39
Joined: Tue Jan 16, 2007 1:27 pm
Reputation: 0
Gender: Male
Contact:

Postby Skyline » Sun Jan 13, 2008 5:04 pm

TheRumpledOne wrote: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



Yeah that's perfect TRO ! I forgot to put those values as external variables :oops: :roll:

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 12778
Joined: Sun May 14, 2006 9:31 pm
Reputation: 1332
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Sun Jan 13, 2008 5:52 pm

Ok, then you can add ZoneWidth as an external and plot the lines I removed...LOL
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.

User avatar
TheRumpledOne
rank: 10000+ posts
rank: 10000+ posts
Posts: 12778
Joined: Sun May 14, 2006 9:31 pm
Reputation: 1332
Location: Oregon
Real name: Avery T. Horton, Jr.
Gender: None specified
Contact:

Postby TheRumpledOne » Mon Jan 14, 2008 5:13 pm

Image

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 add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “MetaTrader”