i need this indicator be a historical one

 


hi guys ...


i need this indicator be a historical one
to be able to make a backtest , the file is attached

 

 

//+------------------------------------------------------------------+
//|                                                     AAA_Emad.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net"

#property indicator_chart_window
extern string name1="EMAD - LEVELS";
extern string name2="By: Eng. Emad";
extern int corner=1;
extern int day=7;
extern double alpha=0.382;
extern color upper1=Red;
extern color upper2=Blue;
extern color upper3=Red;
extern color upper4=Lime;
extern color upper5=Aqua;
extern color upper6=Aqua;
//--------------------------
extern color lower1=Yellow;
extern color lower2=Blue;
extern color lower3=Yellow;
extern color lower4=Lime;
extern color lower5=Aqua;
extern color lower6=Aqua;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   DrawLogo();
     IndicatorShortName("Eng. Emad Gann || Programmed By Mercury_man");

//---- indicators
Print(Open[0]," , ",Open[1]," , ",Open[2]," , ",Open[3]," , ",Open[4]," , ",Open[5]," , ",Open[6]);
   for (int x=1;x<=day-1; x++)
   {
   double p=  iOpen(Symbol(),PERIOD_D1,x-1);

   
   double ns=MathLog(iOpen(Symbol(),PERIOD_D1,x-1)/iOpen(Symbol(),PERIOD_D1,x));

   double sqns=ns*ns;

double ave1=ave1+ns;
double ave2=ave2+sqns;
   }
   ave1=ave1/(day);
   ave2=ave2/(day);
   double RChAv=(ave2-(ave1*ave1));
   double dailyChAv=MathSqrt(RChAv)*100;
   double yearlyChAv=MathSqrt(365)*dailyChAv;
   double daiyPipCh=iOpen(Symbol(),PERIOD_D1,0)*dailyChAv/100;

 
//----
double AAA1=NormalizeDouble(iOpen(Symbol(),PERIOD_D1,0)-alpha*daiyPipCh,Digits);
       ObjectCreate("AAA1",OBJ_HLINE,0,1,AAA1);
       ObjectSet("AAA1", OBJPROP_COLOR, lower1);
       ObjectSet("AAA1", OBJPROP_WIDTH, 1);
       ObjectSet("AAA1",OBJPROP_STYLE,1);
//---------
double AAA2=NormalizeDouble(iOpen(Symbol(),PERIOD_D1,0)+alpha*daiyPipCh,Digits);
       ObjectCreate("AAA2",OBJ_HLINE,0,1,AAA2);
       ObjectSet("AAA2", OBJPROP_COLOR, upper1);
       ObjectSet("AAA2", OBJPROP_WIDTH, 1);
       ObjectSet("AAA2",OBJPROP_STYLE,1);
//---------
double AAA3=NormalizeDouble(iOpen(Symbol(),PERIOD_D1,0)+daiyPipCh,Digits);
       ObjectCreate("AAA3",OBJ_HLINE,0,1,AAA3);
       ObjectSet("AAA3", OBJPROP_COLOR, upper2);
       ObjectSet("AAA3", OBJPROP_WIDTH, 2);
       ObjectSet("AAA3",OBJPROP_STYLE,0);
//---------

double AAA4=NormalizeDouble(AAA3+(AAA3-AAA2)/2,Digits);
       ObjectCreate("AAA4",OBJ_HLINE,0,1,AAA4);
       ObjectSet("AAA4", OBJPROP_COLOR, upper3);
       ObjectSet("AAA4", OBJPROP_WIDTH, 2);
       ObjectSet("AAA4",OBJPROP_STYLE,0);
//---------

double AAA5=NormalizeDouble(AAA2+(AAA3-AAA2)/2,Digits);
       ObjectCreate("AAA5",OBJ_HLINE,0,1,AAA5);
       ObjectSet("AAA5", OBJPROP_COLOR, upper4);
       ObjectSet("AAA5", OBJPROP_WIDTH, 2);
       ObjectSet("AAA5",OBJPROP_STYLE,0);
//---------

double AAA6=NormalizeDouble(AAA4+(AAA2-AAA1),Digits);
       ObjectCreate("AAA6",OBJ_HLINE,0,1,AAA6);
       ObjectSet("AAA6", OBJPROP_COLOR, upper5);
       ObjectSet("AAA6", OBJPROP_WIDTH, 2);
       ObjectSet("AAA6",OBJPROP_STYLE,0);
//---------

double AAA7=NormalizeDouble(AAA6+(AAA2-AAA1),Digits);
       ObjectCreate("AAA7",OBJ_HLINE,0,1,AAA7);
       ObjectSet("AAA7", OBJPROP_COLOR, upper6);
       ObjectSet("AAA7", OBJPROP_WIDTH, 2);
       ObjectSet("AAA7",OBJPROP_STYLE,0);
//---------
double AAA8=NormalizeDouble(iOpen(Symbol(),PERIOD_D1,0)-daiyPipCh,Digits);
       ObjectCreate("AAA8",OBJ_HLINE,0,1,AAA8);
       ObjectSet("AAA8", OBJPROP_COLOR, lower3);
       ObjectSet("AAA8", OBJPROP_WIDTH, 2);
       ObjectSet("AAA8",OBJPROP_STYLE,0);
//---------
double AAA9=NormalizeDouble(AAA8-(AAA1-AAA8)/2,Digits);
       ObjectCreate("AAA9",OBJ_HLINE,0,1,AAA9);
       ObjectSet("AAA9", OBJPROP_COLOR, lower4);
       ObjectSet("AAA9", OBJPROP_WIDTH, 2);
       ObjectSet("AAA9",OBJPROP_STYLE,0);
//----------------
double AAA10=NormalizeDouble(AAA8+(AAA1-AAA8)/2,Digits);
       ObjectCreate("AAA10",OBJ_HLINE,0,1,AAA10);
       ObjectSet("AAA10", OBJPROP_COLOR, lower2);
       ObjectSet("AAA10", OBJPROP_WIDTH, 2);
       ObjectSet("AAA10",OBJPROP_STYLE,0);
//----------------
double AAA11=NormalizeDouble(AAA9-(AAA2-AAA1),Digits);
       ObjectCreate("AAA11",OBJ_HLINE,0,1,AAA11);
       ObjectSet("AAA11", OBJPROP_COLOR, lower5);
       ObjectSet("AAA11", OBJPROP_WIDTH, 2);
       ObjectSet("AAA11",OBJPROP_STYLE,0);

//----------------
double AAA12=NormalizeDouble(AAA11-(AAA2-AAA1),Digits);
       ObjectCreate("AAA12",OBJ_HLINE,0,1,AAA12);
       ObjectSet("AAA12", OBJPROP_COLOR, lower6);
       ObjectSet("AAA12", OBJPROP_WIDTH, 2);
       ObjectSet("AAA12",OBJPROP_STYLE,0);


   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   

//----
   return(0);
  }
//+------------------------------------------------------------------+

void DrawLogo() {
   string l_name_0 = "L_1";
   if (ObjectFind(l_name_0) == -1) {
      ObjectCreate(l_name_0, OBJ_LABEL, 0, 0, 0);
      ObjectSet(l_name_0, OBJPROP_CORNER, corner);
      ObjectSet(l_name_0, OBJPROP_XDISTANCE, 10);
      ObjectSet(l_name_0, OBJPROP_YDISTANCE, 10);
   }
   ObjectSetText(l_name_0, name1, 22, "Arial", White);
   l_name_0 =  "L_2";
   if (ObjectFind(l_name_0) == -1) {
      ObjectCreate(l_name_0, OBJ_LABEL, 0, 0, 0);
      ObjectSet(l_name_0, OBJPROP_CORNER, corner);
      ObjectSet(l_name_0, OBJPROP_XDISTANCE, 10);
      ObjectSet(l_name_0, OBJPROP_YDISTANCE, 40);
   }
   ObjectSetText(l_name_0, name2, 14, "Arial", Gold);
   l_name_0 =  "L_3";
   if (ObjectFind(l_name_0) == -1) {
      ObjectCreate(l_name_0, OBJ_LABEL, 0, 0, 0);
      ObjectSet(l_name_0, OBJPROP_CORNER, corner);
      ObjectSet(l_name_0, OBJPROP_XDISTANCE, 10);
      ObjectSet(l_name_0, OBJPROP_YDISTANCE, 44);
   }
   ObjectSetText(l_name_0, "______________", 12, "Arial", White);



}
Files:
AAA_Emad.mq4  7 kb
 
akram801:


hi guys ...


i need this indicator be a historical one
to be able to make a backtest , the file is attached


Hi akram801,

You already ask about that in mql4 forum https://www.mql5.com/en/forum/141097 and got the answer.

Don't ask something for free, no everybody willing to set aside time coding for someone else especially for free.

If you want to get a decent help, show what coding did you make so far. They will appreciate that and willing to help.

 

i need this indicator be a historical one - MQL4 forum
  • www.mql5.com
i need this indicator be a historical one - MQL4 forum