impulseMACD_Xopen_Body_v3

Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
impulseMACD_Xopen_Body_v3
//+------------------------------------------------------------------+
//| CoreWinTT æåëàåò Âàì óñïåõîâ è óäà÷è! :)                           
//+------------------------------------------------------------------+

#property link      "CoreWinTT"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Aqua
#property indicator_width1 2
#property indicator_color2 Aqua
#property indicator_width2 2
#property indicator_color3 Magenta
#property indicator_width3 2
#property indicator_color4 Magenta
#property indicator_width4 2 
#property indicator_color5 MediumPurple
#property indicator_width5 2
#property indicator_color6 MediumPurple
#property indicator_width6 2
extern bool UseGlobal=true;

extern double ColdSintez=1;
extern int ElderEMA=13;
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalEMA=9;
extern int OsmaX=2;

extern bool TwoColor=false;

extern int PozzX = 10;
extern int PozzY = 15;
extern int Font_Size = 9;
extern bool ShowInfo =false;
string Label="ImpulseMACD_Xopen_Body";
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_HISTOGRAM,STYLE_SOLID,2);
   SetIndexBuffer(5,ExtMapBuffer6);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   bool UseOneColor=false;
   if(UseGlobal)
     {
      int dt;
      if((Time[0]-Time[1])>(Time[1]-Time[2])) dt=(Time[1]-Time[2])/60;
      else dt=(Time[0]-Time[1])/60;
      ElderEMA=  GlobalVariableGet("BMACD4_"+dt+Symbol()+"ElderEMA");
      FastEMA =   GlobalVariableGet("BMACD4_"+dt+Symbol()+"FastEMA");
      SlowEMA =   GlobalVariableGet("BMACD4_"+dt+Symbol()+"SlowEMA");
      SignalEMA= GlobalVariableGet("BMACD4_"+dt+Symbol()+"SignalEMA");
      TwoColor = GlobalVariableGet("BMACD4_"+dt+Symbol()+"TwoColor");

     }

   int counted_bars = IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars > 0)   counted_bars--;
   int i = Bars - counted_bars;
   if(counted_bars==0) i--;
   
   while(i>=0)
     {
      double L_1 = iCustom(NULL,0,"Bestmacd_v5",ColdSintez,ElderEMA,FastEMA,SlowEMA,SignalEMA,OsmaX,TwoColor,true,true,2,i); //buy 
      double L_2 = iCustom(NULL,0,"Bestmacd_v5",ColdSintez,ElderEMA,FastEMA,SlowEMA,SignalEMA,OsmaX,TwoColor,true,true,1,i); //sell

      if(L_1!=0.0)
        {
         ExtMapBuffer1[i]=Open[i];ExtMapBuffer2[i]=Close[i];
         ExtMapBuffer3[i]=Open[i];ExtMapBuffer4[i]=Open[i];
         ExtMapBuffer5[i]=Open[i];ExtMapBuffer6[i]=Open[i];
        }
      else{if(L_2!=0.0)
           {
            ExtMapBuffer3[i]=Open[i];ExtMapBuffer4[i]=Close[i];
            ExtMapBuffer1[i]=Open[i];ExtMapBuffer2[i]=Open[i];
            ExtMapBuffer5[i]=Open[i];ExtMapBuffer6[i]=Open[i];
           }
         else
           {
            ExtMapBuffer5[i]=Open[i];ExtMapBuffer6[i]=Close[i];
            ExtMapBuffer1[i]=Open[i];ExtMapBuffer2[i]=Open[i];
            ExtMapBuffer3[i]=Open[i];ExtMapBuffer4[i]=Open[i];

           }
        }

      i--;

     }
//----
   if(ShowInfo==true)
     {
      double Lk_1 = iCustom(NULL,0,"Bestmacd_v5",ColdSintez,ElderEMA,FastEMA,SlowEMA,SignalEMA,OsmaX,TwoColor,true,true,2,0); //buy 
      double Lk_2 = iCustom(NULL,0,"Bestmacd_v5",ColdSintez,ElderEMA,FastEMA,SlowEMA,SignalEMA,OsmaX,TwoColor,true,true,1,0); //sell

      if(Lk_1!=0.0)
        {
         ObjectCreate(Label, OBJ_LABEL, 0, 0, 0);// Ñîçäàíèå îáú.   
         ObjectSet(Label, OBJPROP_CORNER, 1);    // Ïðèâÿçêà óãîë   
         ObjectSet(Label, OBJPROP_XDISTANCE, PozzX);// Êîîðäèíàòà Õ   
         ObjectSet(Label, OBJPROP_YDISTANCE, PozzY);// Êîîðäèíàòà y
         ObjectSetText(Label,"MA("+ElderEMA+")MACD("+FastEMA+","+SlowEMA+","+SignalEMA+")",Font_Size,"Arial Black",Aqua);   // ("MACD("+FastEMA+","+SlowEMA+","+SignalEMA+")");
         WindowRedraw();

        }
      else{if(Lk_2!=0.0)
           {
            ObjectCreate(Label, OBJ_LABEL, 0, 0, 0);// Ñîçäàíèå îáú.   
            ObjectSet(Label, OBJPROP_CORNER, 1);    // Ïðèâÿçêà óãîë   
            ObjectSet(Label, OBJPROP_XDISTANCE, PozzX);// Êîîðäèíàòà Õ   
            ObjectSet(Label, OBJPROP_YDISTANCE, PozzY);// Êîîðäèíàòà y
            ObjectSetText(Label,"MA("+ElderEMA+")MACD("+FastEMA+","+SlowEMA+","+SignalEMA+")",Font_Size,"Arial Black",Magenta);
            WindowRedraw();

           }
         else
           {
            ObjectCreate(Label, OBJ_LABEL, 0, 0, 0);// Ñîçäàíèå îáú.   
            ObjectSet(Label, OBJPROP_CORNER, 1);    // Ïðèâÿçêà óãîë   
            ObjectSet(Label, OBJPROP_XDISTANCE, PozzX);// Êîîðäèíàòà Õ   
            ObjectSet(Label, OBJPROP_YDISTANCE, PozzY);// Êîîðäèíàòà y
            ObjectSetText(Label,"MA("+ElderEMA+")MACD("+FastEMA+","+SlowEMA+","+SignalEMA+")",Font_Size,"Arial Black",Purple);
            WindowRedraw();

           }
        }

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

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---