Jump to content

Can someone please edit these indies to work with 5 digit brokers?


skid-z

Recommended Posts

Hi retireme,

 

Not so good, i think the 1000_5 did not shown correctly.

Suggest that you need not change the factors.

 

What you need to do fool the MT broker to think it is 4 digits by rename the "Point" to other variable like xPoint.

 

declare it as

double xPoint

 

if (Symbol() == "GBPJPY" || Symbol() == "USDJPY" || Symbol() == "CADJPY" || Symbol() == "EURJPY" || Symbol() == "CHFJPY" || Symbol() == "NZDJPY" || Symbol() == "AUDJPY")

{

ld_28 = 0;

xPoint = 0.01;

}

else

xPoint = 0.0001;

 

 

The "Digits" maybe need to fool as "xDigits"

 

input same above

xDigits = 4;

if xxxJPY then xDigs = 2;

 

 

 

Try it out.

Link to comment
Share on other sites

Hi retireme,

 

Not so good, i think the 1000_5 did not shown correctly.

Suggest that you need not change the factors.

 

What you need to do fool the MT broker to think it is 4 digits by rename the "Point" to other variable like xPoint.

 

declare it as

double xPoint

 

if (Symbol() == "GBPJPY" || Symbol() == "USDJPY" || Symbol() == "CADJPY" || Symbol() == "EURJPY" || Symbol() == "CHFJPY" || Symbol() == "NZDJPY" || Symbol() == "AUDJPY")

{

ld_28 = 0;

xPoint = 0.01;

}

else

xPoint = 0.0001;

 

 

The "Digits" maybe need to fool as "xDigits"

 

input same above

xDigits = 4;

if xxxJPY then xDigs = 2;

 

 

 

Try it out.

 

Thanks for the info... haven't really got time at the moment but will have a look later. The information about the indi is bit scant really...have no idea what it is supposed to be doing and therefore hard to follow the logic inside the code.

 

Rgds

RM

Link to comment
Share on other sites

Hi retireme,

 

Here the Grid1000



/********************************
 Script from skid-z,  Modified by ArtOfTrade
********************************/


#property indicator_chart_window

extern string Label.Font = "Arial";
extern int    Label.FontSize = 8;

extern color  Line.Color0  = White;
extern color  Line.Color21 = Blue;
extern color  Line.Color34 = Lime;
extern color  Line.Color55 = Yellow;
extern color  Line.Color89 = Red;

extern int Line.Width = 4;
extern int Line.Style = STYLE_SOLID;

string CheckDate = " ";


int init() 
{
  return (0);
}

int deinit() 
{

  for(int i=ObjectsTotal()-1; i>-1; i--)
   if (StringFind(ObjectName(i),"1000")>=0)  
        ObjectDelete(ObjectName(i));   

  return (0);
}



int start() 
{
  
  string CurrDate = TimeToStr(iTime(NULL, PERIOD_D1, 1), TIME_DATE);
  if (CurrDate == CheckDate) return (0);
  CheckDate = CurrDate;
  
  double DailyClose = iClose(NULL, PERIOD_D1, 1);
  
 double ML; 
 double xPoint = 0.0001;   

   
  
  if (StringSubstr(Symbol(), 3) == "JPY")
  {
      ML = 100.0 * MathRound(10.0 * DailyClose / 100.0) / 10.0;
      xPoint = 0.01;
      
  }   
  else
  {
      ML = MathRound(10.0 * DailyClose) / 10.0;
      xPoint = 0.0001;
  }
  
  double HL = ML + 1000.0 * xPoint;
  double LL = ML - 1000.0 * xPoint;
  
  
  double LL_21P = LL + 210.0 * xPoint;
  double LL_34P = LL + 340.0 * xPoint;
  double LL_55P = LL + 550.0 * xPoint;
  double LL_89P = LL + 890.0 * xPoint;
  /*
  double LL_21M = LL - 210.0 * xPoint;
  double LL_34M = LL - 340.0 * xPoint;
  double LL_55M = LL - 550.0 * xPoint;
  double LL_88M = LL - 890.0 * xPoint; */
  
  double ML_21P = ML + 210.0 * xPoint;
  double ML_34P = ML + 340.0 * xPoint;
  double ML_55P = ML + 550.0 * xPoint;
  double ML_89P = ML + 890.0 * xPoint;
  
  double ML_21M = ML - 210.0 * xPoint;
  double ML_34M = ML - 340.0 * xPoint;
  double ML_55M = ML - 550.0 * xPoint;
  double ML_89M = ML - 890.0 * xPoint;
  
  double HL_89M = HL - 890.0 * xPoint;
  double HL_55M = HL - 550.0 * xPoint;
  double HL_34M = HL - 340.0 * xPoint;
  double HL_21M = HL - 210.0 * xPoint;
  /*
  double HL_89P = HL + 890.0 * xPoint;
  double HL_55P = HL + 550.0 * xPoint;
  double HL_34P = HL + 340.0 * xPoint;
  double HL_21P = HL + 210.0 * xPoint; */

  double LabelAt = LL + 7.0 * xPoint;
  drawLine("1000L", LL, Line.Color0);
  drawLabel("1000 Low", "1000 Low Line", LabelAt, Line.Color0);

  LabelAt = HL + 7.0 * xPoint;
  drawLine("1000H", HL, Line.Color0);
  drawLabel("1000 High", "1000 High Line", LabelAt, Line.Color0);
  
  LabelAt = ML + 7.0 * xPoint;
  drawLine("1000M", ML, Line.Color0);
  drawLabel("1000 Mid", "1000 Mid Line", LabelAt, Line.Color0);
  
  
  LabelAt = LL_21P + 7.0 * xPoint;
  drawLine("1000_L21P Line", LL_21P, Line.Color21);
  drawLabel("1000_L21P", "1000_L21P Line", LabelAt, Line.Color21);
  
  LabelAt = LL_34P + 7.0 * xPoint;
  drawLine("1000_L34P Line", LL_34P, Line.Color34);
  drawLabel("1000_L34P", "1000_L34P Line", LabelAt, Line.Color34);
  
  LabelAt = LL_55P + 7.0 * xPoint;
  drawLine("1000_L55P Line", LL_55P, Line.Color55);
  drawLabel("1000_L55P", "1000_L55P Line", LabelAt, Line.Color55);
  
  LabelAt = LL_89P + 7.0 * xPoint;
  drawLine("1000_L89P Line", LL_89P, Line.Color89);
  drawLabel("1000_L89P", "1000_L89P Line", LabelAt, Line.Color89);
  
  LabelAt = ML_89P + 7.0 * xPoint;
  drawLine("1000_M89P Line", ML_89P, Line.Color89);
  drawLabel("1000_M89P", "1000_M89P Line", LabelAt, Line.Color89);
  
  LabelAt = ML_89M + 7.0 * xPoint;
  drawLine("1000_M89M Line", ML_89M, Line.Color89);
  drawLabel("1000_M89M", "1000_M89M Line", LabelAt, Line.Color89);
  
  LabelAt = ML_55P + 7.0 * xPoint;
  drawLine("1000_M55P Line", ML_55P, Line.Color55);
  drawLabel("1000_M55P", "1000_M55P Line", LabelAt, Line.Color55);
  
  LabelAt = ML_55M + 7.0 * xPoint;
  drawLine("1000_M55M Line", ML_55M, Line.Color55);
  drawLabel("1000_M55M", "1000_M55M Line", LabelAt, Line.Color55);
  
  LabelAt = ML_34P + 7.0 * xPoint;
  drawLine("1000_M34P Line", ML_34P, Line.Color34);
  drawLabel("1000_M34P", "1000_M34P Line", LabelAt, Line.Color34);
  
  LabelAt = ML_34M + 7.0 * xPoint;
  drawLine("1000_M34M Line", ML_34M, Line.Color34);
  drawLabel("1000_M34M", "1000_M34M Line", LabelAt, Line.Color34);
  
  LabelAt = ML_21P + 7.0 * xPoint;
  drawLine("1000_M21P Line", ML_21P, Line.Color21);
  drawLabel("1000_M21P", "1000_M21P Line", LabelAt, Line.Color21);
  
  LabelAt = ML_21M + 7.0 * xPoint;
  drawLine("1000_M21M Line", ML_21M, Line.Color21);
  drawLabel("1000_M21M", "1000_M21M Line", LabelAt, Line.Color21);
  
  LabelAt = HL_89M + 7.0 * xPoint;
  drawLine("1000_H89M Line", HL_89M, Line.Color89);
  drawLabel("1000_H89M", "1000_H89M Line", LabelAt, Line.Color89);
  
  LabelAt = HL_55M + 7.0 * xPoint;
  drawLine("1000_55M Line", HL_55M, Line.Color55);
  drawLabel("1000_55M", "1000_H55M Line", LabelAt, Line.Color55);
  
  LabelAt = HL_21M + 7.0 * xPoint;
  drawLine("1000_H21M Line", HL_21M, Line.Color21);
  drawLabel("1000_H21M", "1000_H21M Line", LabelAt, Line.Color21);
  
  LabelAt = HL_34M + 7.0 * xPoint;
  drawLine("1000_H34M Line", HL_34M, Line.Color34);
  drawLabel("1000_H34M", "1000_H34M Line", LabelAt, Line.Color34);
  
  return (0);
}

void drawLabel(string ObjName, string DrawText, double Price, color Color) {
  if (ObjectFind(ObjName) != 0) {
     ObjectCreate(ObjName, OBJ_TEXT, 0, Time[WindowFirstVisibleBar() - 6], Price);
     ObjectSetText(ObjName, DrawText, Label.FontSize, Label.Font, CLR_NONE);
     ObjectSet(ObjName, OBJPROP_COLOR, Color);
     //ObjectSet(ObjName, OBJPROP_TIME1, Time[WindowFirstVisibleBar() - 6]);

  }
  else
  ObjectMove(ObjName, 0, Time[WindowFirstVisibleBar() - 6], Price);
}

void drawLine(string ObjName, double Price, color Color) {
  if (ObjectFind(ObjName) != 0) {
     ObjectCreate(ObjName, OBJ_HLINE, 0, Time[0], Price);
     ObjectSet(ObjName, OBJPROP_STYLE, Line.Style);
     ObjectSet(ObjName, OBJPROP_COLOR, Color);
     ObjectSet(ObjName, OBJPROP_WIDTH, Line.Width);
  }
  else
  ObjectMove(ObjName, 0, Time[0], Price);
  //ObjectCreate(ObjName, OBJ_HLINE, 0, Time[0], Price);
  //ObjectSet(ObjName, OBJPROP_STYLE, STYLE_SOLID);
  //ObjectSet(ObjName, OBJPROP_COLOR, Color);
  //ObjectSet(ObjName, OBJPROP_WIDTH, 4);
}

Edited by ArtOfTrade
Link to comment
Share on other sites

Hi RetireMe,

 

Here the Grid500:

/*****************************************************
  Script by Skid-z, modified by ArtOfTrade
******************************************************/
#property indicator_chart_window

extern color  Line.Color0  = White;
extern color  Line.Color21 = Blue;
extern color  Line.Color34 = Lime;
extern color  Line.Color55 = Yellow;
extern color  Line.Color89 = Red;

extern int Line.Width = 2;
extern int Line.Style = STYLE_SOLID;

string CheckDate = " ";



int init() {
  return (0);
}

int deinit() 
{

  for(int i=ObjectsTotal()-1; i>-1; i--)
   if (StringFind(ObjectName(i),"500")>=0)  
        ObjectDelete(ObjectName(i));   

  return (0);
}

int start() 
{
  string CurrDate = TimeToStr(iTime(NULL, PERIOD_D1, 1), TIME_DATE);
  if (CurrDate == CheckDate) return (0);
  CheckDate = CurrDate;
  
  double DailyClose = iClose(NULL, PERIOD_D1, 1);
  
  double ML;
  
  double  xPoint = 0.0001;
  
  if (StringSubstr(Symbol(), 3) == "JPY")
  {
      ML = 10.0 * MathRound(DailyClose / 10.0);
      xPoint = 0.01;
      
      
  }   
  else
  {
      ML = MathRound(10.0 * DailyClose) / 10.0;
      xPoint = 0.0001;
  }
  
  
  double HL = ML + 500.0 * xPoint;
  double LL = ML - 500.0 * xPoint;
  
  
  
  if (ML > DailyClose && DailyClose >= LL) 
  {
     if (ML - DailyClose >= DailyClose - LL) ML -= 500.0 * xPoint;
  } 
  else 
  {
     if (ML < DailyClose && DailyClose <= HL)
        if (DailyClose - ML <= HL - DailyClose) ML += 500.0 * xPoint;
  }
  
  double LL_21P = LL + 210.0/2 * xPoint;
  double LL_34P = LL + 340.0/2 * xPoint;
  double LL_55P = LL + 550.0/2 * xPoint;
  double LL_89P = LL + 890.0/2 * xPoint;
  
  double HL_99M = HL - 890.0/2 * xPoint;
  double HL_55M = HL - 550.0/2 * xPoint;
  double HL_34M = HL - 340.0/2 * xPoint;
  double HL_21M = HL - 210.0/2 * xPoint;
  
  double ML_21P = ML + 210.0/2 * xPoint;
  double ML_34P = ML + 340.0/2 * xPoint;
  double ML_55P = ML + 550.0/2 * xPoint;
  double ML_89P = ML + 890.0/2 * xPoint;
  
  double ML_21M = ML - 210.0/2 * xPoint;
  double ML_34M = ML - 340.0/2 * xPoint;
  double ML_55M = ML - 550.0/2 * xPoint;
  double ML_89M = ML - 890.0/2 * xPoint;
  
  drawLine("500_High", HL,     Line.Color0 );
  drawLine("500_Mid",  ML,     Line.Color0 );
  drawLine("500_Low",  LL,     Line.Color0 );
  
  drawLine("500_L21P", LL_21P, Line.Color21);
  drawLine("500_L34P", LL_34P, Line.Color34);
  drawLine("500_L55P", LL_55P, Line.Color55);
  drawLine("500_L89P", LL_89P, Line.Color89);
  
  drawLine("500_M21P", ML_21P, Line.Color21 );
  drawLine("500_M34P", ML_34P, Line.Color34);
  drawLine("500_M55P", ML_55P, Line.Color55);
  drawLine("500_M89P", ML_89P, Line.Color89);
  
  drawLine("500_H21M", HL_21M, Line.Color21 );
  drawLine("500_H34M", HL_34M, Line.Color34);
  drawLine("500_H55M", HL_55M, Line.Color55);
  drawLine("500_H89M", HL_99M, Line.Color89);
  
  drawLine("500_M21M", ML_21M, Line.Color21 );
  drawLine("500_M34M", ML_34M, Line.Color34);
  drawLine("500_M55M", ML_55M, Line.Color55);
  drawLine("500_M89M", ML_89M, Line.Color89);
  
  return (0);
}


void drawLine(string ObjName, double Price, color Color) {
  if (ObjectFind(ObjName) != 0) {
     ObjectCreate(ObjName, OBJ_HLINE, 0, Time[0], Price);
     ObjectSet(ObjName, OBJPROP_STYLE, Line.Style);
     ObjectSet(ObjName, OBJPROP_COLOR, Color);
     ObjectSet(ObjName, OBJPROP_WIDTH, Line.Width);
  }
  else
  ObjectMove(ObjName, 0, Time[0], Price);
  //ObjectCreate(ObjName, OBJ_HLINE, 0, Time[0], Price);
  //ObjectSet(ObjName, OBJPROP_STYLE, STYLE_SOLID);
  //ObjectSet(ObjName, OBJPROP_COLOR, Color);
  //ObjectSet(ObjName, OBJPROP_WIDTH, 4);
}

Edited by ArtOfTrade
Link to comment
Share on other sites

Thanks guys. I'll try them later when I get home from work. They are indeed VERY powerful fibo number based S&R indicators. I had cracked them from EX4 to MQ4 using the EX4 to OPENPLON program which is why there is no specific detail to the code. I tried modifying it myself initially, but my lack of experience in coding only messed things up.

 

I will also try to find the original document that explains step-by-step how to manually draw all lines on your chart. I will post this as my thank you for your help :-)

 

Thanks again, you guys ROCK!

Edited by skid-z
Link to comment
Share on other sites

Hi,

 

This is the final change. I had combine both Grid1000 and Grid500 into one indicator.

There are huge modification, may had bugs unforeseen. Code is easy understand for

some expert here. I am done, leave it to you all now.

 

//+------------------------------------------------------------------+
//|                                                    GridFibRN.mq4                      |
//|                      Copyright © 2011, MetaQuotes Software Corp.        |
//|                                        http://www.metaquotes.net               |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"


#property indicator_chart_window

extern bool DrawGrid1000.Enable = true;
extern bool DrawGrid500.Enable = false;
extern string Label.Font = "Arial";
extern int    Label.FontSize = 8;
extern int    Label.Shift  = 3.0;

extern color  Line1000.Color0  = White;
extern color  Line1000.Color21 = Blue;
extern color  Line1000.Color34 = Lime;
extern color  Line1000.Color55 = Yellow;
extern color  Line1000.Color89 = Red;

extern int Line1000.Width = 4;
extern int Line1000.Style = STYLE_SOLID;


extern color  Line500.Color0  = White;
extern color  Line500.Color21 = Blue;
extern color  Line500.Color34 = Lime;
extern color  Line500.Color55 = Yellow;
extern color  Line500.Color89 = Red;

extern int Line500.Width = 2;
extern int Line500.Style = STYLE_SOLID;


string CheckDate = " ";

double DailyClose;
double xPoint = 0.0001;   
double ML;

int Line.Style;
int Line.Width;


int init() 
{
  return (0);
}

int deinit() 
{

  for(int i=ObjectsTotal()-1; i>-1; i--)
  {
   if (StringFind(ObjectName(i),"1000")>=0)  
        ObjectDelete(ObjectName(i));   
   if (StringFind(ObjectName(i),"500")>=0)  
        ObjectDelete(ObjectName(i));        
  }
  return (0);
}


int start() 
{
  string CurrDate = TimeToStr(iTime(NULL, PERIOD_D1, 1), TIME_DATE);
  if (CurrDate == CheckDate) return (0);
  CheckDate = CurrDate;
  
  DailyClose = iClose(NULL, PERIOD_D1, 1);
  if (Digits>=4)
      xPoint = 0.0001;
  else    
      xPoint = 0.01;

  ML =  1000.0*xPoint*MathRound(DailyClose/xPoint/1000.0);
     
  if (DrawGrid1000.Enable) DrawGrid1000(); 
  if (DrawGrid500.Enable) DrawGrid500(); 
  
  return (0);
}

void DrawGrid1000() 
{
  
  
  
  double HL = ML + 1000.0 * xPoint;
  double LL = ML - 1000.0 * xPoint;
  
  
  double LL_21P = LL + 210.0 * xPoint;
  double LL_34P = LL + 340.0 * xPoint;
  double LL_55P = LL + 550.0 * xPoint;
  double LL_89P = LL + 890.0 * xPoint;
  
  double ML_21P = ML + 210.0 * xPoint;
  double ML_34P = ML + 340.0 * xPoint;
  double ML_55P = ML + 550.0 * xPoint;
  double ML_89P = ML + 890.0 * xPoint;
  
  double ML_21M = ML - 210.0 * xPoint;
  double ML_34M = ML - 340.0 * xPoint;
  double ML_55M = ML - 550.0 * xPoint;
  double ML_89M = ML - 890.0 * xPoint;
  
  double HL_89M = HL - 890.0 * xPoint;
  double HL_55M = HL - 550.0 * xPoint;
  double HL_34M = HL - 340.0 * xPoint;
  double HL_21M = HL - 210.0 * xPoint;

  double LabelAt = LL + Label.Shift * xPoint;
  
  Line.Style = Line1000.Style;
  Line.Width = Line1000.Width;
  
  drawLine ("1000_L", LL, Line1000.Color0);
  drawLabel("1000_L", "1000 Low Line", LabelAt, Line1000.Color0);

  LabelAt = HL + Label.Shift * xPoint;
  drawLine ("1000_H", HL, Line1000.Color0);
  drawLabel("1000_H", "1000 High Line", LabelAt, Line1000.Color0);
  
  LabelAt = ML + Label.Shift * xPoint;
  drawLine ("1000_M", ML, Line1000.Color0);
  drawLabel("1000_M", "1000 Mid Line", LabelAt, Line1000.Color0);
  
  
  LabelAt = LL_21P + Label.Shift * xPoint;
  drawLine ("1000_L21P", LL_21P, Line1000.Color21);
  drawLabel("1000_L21P", "1000_L21P Line", LabelAt, Line1000.Color21);
  
  LabelAt = LL_34P + Label.Shift * xPoint;
  drawLine ("1000_L34P", LL_34P, Line1000.Color34);
  drawLabel("1000_L34P", "1000_L34P Line", LabelAt, Line1000.Color34);
  
  LabelAt = LL_55P + Label.Shift * xPoint;
  drawLine ("1000_L55P", LL_55P, Line1000.Color55);
  drawLabel("1000_L55P", "1000_L55P Line", LabelAt, Line1000.Color55);
  
  LabelAt = LL_89P + Label.Shift * xPoint;
  drawLine ("1000_L89P", LL_89P, Line1000.Color89);
  drawLabel("1000_L89P", "1000_L89P Line", LabelAt, Line1000.Color89);
  
  LabelAt = ML_89P + Label.Shift * xPoint;
  drawLine ("1000_M89P", ML_89P, Line1000.Color89);
  drawLabel("1000_M89P", "1000_M89P Line", LabelAt, Line1000.Color89);
  
  LabelAt = ML_89M + Label.Shift * xPoint;
  drawLine ("1000_M89M", ML_89M, Line1000.Color89);
  drawLabel("1000_M89M", "1000_M89M Line", LabelAt, Line1000.Color89);
  
  LabelAt = ML_55P + Label.Shift * xPoint;
  drawLine ("1000_M55P", ML_55P, Line1000.Color55);
  drawLabel("1000_M55P", "1000_M55P Line", LabelAt, Line1000.Color55);
  
  LabelAt = ML_55M + Label.Shift * xPoint;
  drawLine ("1000_M55M", ML_55M, Line1000.Color55);
  drawLabel("1000_M55M", "1000_M55M Line", LabelAt, Line1000.Color55);
  
  LabelAt = ML_34P + Label.Shift * xPoint;
  drawLine ("1000_M34P", ML_34P, Line1000.Color34);
  drawLabel("1000_M34P", "1000_M34P Line", LabelAt, Line1000.Color34);
  
  LabelAt = ML_34M + Label.Shift * xPoint;
  drawLine ("1000_M34M", ML_34M, Line1000.Color34);
  drawLabel("1000_M34M", "1000_M34M Line", LabelAt, Line1000.Color34);
  
  LabelAt = ML_21P + Label.Shift * xPoint;
  drawLine ("1000_M21P", ML_21P, Line1000.Color21);
  drawLabel("1000_M21P", "1000_M21P Line", LabelAt, Line1000.Color21);
  
  LabelAt = ML_21M + Label.Shift * xPoint;
  drawLine ("1000_M21M", ML_21M, Line1000.Color21);
  drawLabel("1000_M21M", "1000_M21M Line", LabelAt, Line1000.Color21);
  
  LabelAt = HL_89M + Label.Shift * xPoint;
  drawLine ("1000_H89M", HL_89M, Line1000.Color89);
  drawLabel("1000_H89M", "1000_H89M Line", LabelAt, Line1000.Color89);
  
  LabelAt = HL_55M + Label.Shift * xPoint;
  drawLine ("1000_55M", HL_55M, Line1000.Color55);
  drawLabel("1000_55M", "1000_H55M Line", LabelAt, Line1000.Color55);
  
  LabelAt = HL_21M + Label.Shift * xPoint;
  drawLine ("1000_H21M", HL_21M, Line1000.Color21);
  drawLabel("1000_H21M", "1000_H21M Line", LabelAt, Line1000.Color21);
  
  LabelAt = HL_34M + Label.Shift * xPoint;
  drawLine ("1000_H34M", HL_34M, Line1000.Color34);
  drawLabel("1000_H34M", "1000_H34M Line", LabelAt, Line1000.Color34);
  
  
}


int DrawGrid500() 
{
  
  double HL = ML + 500.0 * xPoint;
  double LL = ML - 500.0 * xPoint;
  
  
  if (ML > DailyClose && DailyClose >= LL) 
     if (ML - DailyClose >= DailyClose - LL) ML -= 500.0 * xPoint;
  else 
     if (ML < DailyClose && DailyClose <= HL)
        if (DailyClose - ML <= HL - DailyClose) ML += 500.0 * xPoint;
  
  double LL_21P = LL + 210.0/2 * xPoint;
  double LL_34P = LL + 340.0/2 * xPoint;
  double LL_55P = LL + 550.0/2 * xPoint;
  double LL_89P = LL + 890.0/2 * xPoint;
  
  double HL_99M = HL - 890.0/2 * xPoint;
  double HL_55M = HL - 550.0/2 * xPoint;
  double HL_34M = HL - 340.0/2 * xPoint;
  double HL_21M = HL - 210.0/2 * xPoint;
  
  double ML_21P = ML + 210.0/2 * xPoint;
  double ML_34P = ML + 340.0/2 * xPoint;
  double ML_55P = ML + 550.0/2 * xPoint;
  double ML_89P = ML + 890.0/2 * xPoint;
  
  double ML_21M = ML - 210.0/2 * xPoint;
  double ML_34M = ML - 340.0/2 * xPoint;
  double ML_55M = ML - 550.0/2 * xPoint;
  double ML_89M = ML - 890.0/2 * xPoint;

  Line.Style = Line500.Style;
  Line.Width = Line500.Width;
  
  drawLine("500_High", HL,     Line500.Color0 );
  drawLine("500_Mid",  ML,     Line500.Color0 );
  drawLine("500_Low",  LL,     Line500.Color0 );
  
  drawLine("500_L21P", LL_21P, Line500.Color21);
  drawLine("500_L34P", LL_34P, Line500.Color34);
  drawLine("500_L55P", LL_55P, Line500.Color55);
  drawLine("500_L89P", LL_89P, Line500.Color89);
  
  drawLine("500_M21P", ML_21P, Line500.Color21 );
  drawLine("500_M34P", ML_34P, Line500.Color34);
  drawLine("500_M55P", ML_55P, Line500.Color55);
  drawLine("500_M89P", ML_89P, Line500.Color89);
  
  drawLine("500_H21M", HL_21M, Line500.Color21 );
  drawLine("500_H34M", HL_34M, Line500.Color34);
  drawLine("500_H55M", HL_55M, Line500.Color55);
  drawLine("500_H89M", HL_99M, Line500.Color89);
  
  drawLine("500_M21M", ML_21M, Line500.Color21 );
  drawLine("500_M34M", ML_34M, Line500.Color34);
  drawLine("500_M55M", ML_55M, Line500.Color55);
  drawLine("500_M89M", ML_89M, Line500.Color89);
  
  return (0);
}


void drawLabel(string name, string DrawText, double Price, color Color) {

 string objname = name + "_label";

  if (ObjectFind(objname) != 0) {
     ObjectCreate(objname, OBJ_TEXT, 0, Time[WindowFirstVisibleBar() - 6], Price);
     ObjectSetText(objname, DrawText, Label.FontSize, Label.Font, CLR_NONE);
     ObjectSet(objname, OBJPROP_COLOR, Color);

  }
  else
  ObjectMove(objname, 0, Time[WindowFirstVisibleBar() - 6], Price);
}

void drawLine(string name, double Price, color Color) {

 string objname = name + "_line";  

  if (ObjectFind(objname) != 0) {
     ObjectCreate(objname, OBJ_HLINE, 0, Time[0], Price);
     ObjectSet(objname, OBJPROP_STYLE, Line.Style);
     ObjectSet(objname, OBJPROP_COLOR, Color);
     ObjectSet(objname, OBJPROP_WIDTH, Line.Width);
  }
  else
  ObjectMove(objname, 0, Time[0], Price);
}

Link to comment
Share on other sites

Hi,

 

This is the final change. I had combine both Grid1000 and Grid500 into one indicator.

There are huge modification, may had bugs unforeseen. Code is easy understand for

some expert here. I am done, leave it to you all now.

 

Quite amazing my friend... thank you very much for the time you allotted to this.

 

Rgds

RM

Link to comment
Share on other sites

Hi retireme,

 

Not so good, i think the 1000_5 did not shown correctly.

Suggest that you need not change the factors.

 

What you need to do fool the MT broker to think it is 4 digits by rename the "Point" to other variable like xPoint.

 

declare it as

double xPoint

 

if (Symbol() == "GBPJPY" || Symbol() == "USDJPY" || Symbol() == "CADJPY" || Symbol() == "EURJPY" || Symbol() == "CHFJPY" || Symbol() == "NZDJPY" || Symbol() == "AUDJPY")

{

ld_28 = 0;

xPoint = 0.01;

}

else

xPoint = 0.0001;

 

 

The "Digits" maybe need to fool as "xDigits"

 

input same above

xDigits = 4;

if xxxJPY then xDigs = 2;

 

 

 

Try it out.

 

Hi ArtOfTrade,

why do you care about pairs?

 

double        myPoint;                              // support for 3/5 decimal places

int init()
  // get normalized Point based on Broker decimal places
  myPoint = SetPoint();


double SetPoint()
{
  double mPoint;
 
  if (Digits < 4)
     mPoint = 0.01;
  else
     mPoint = 0.0001;
 
  return(mPoint);
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...