Download MetaTrader 5

help me to output the right values from the indicator to the EA

To add comments, please log in or register
kiurire
177
kiurire  
INDICATOR CODE

//+------------------------------------------------------------------+
//|                                           Indicator: TurboEA.mq4 |
//|                                           Created by CrazyTrader |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016 CrazyTader"
#property link      "Facebook.com/CrazyTrader"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

extern int ADXbars = 14;
extern int CountBars = 350;


double G_ibuf_84[];
double G_ibuf_88[];
double G_iadx_92;
double G_iadx_100;
double G_iadx_108;
double G_iadx_116;
int G_bars_100 = Bars;
int G_count_104 = 0;
bool Gi_108;
  
// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   string ;
   IndicatorBuffers(2);
   SetIndexStyle(0, DRAW_ARROW,EMPTY,1);
   SetIndexArrow(0, 221);
   SetIndexStyle(1, DRAW_ARROW,EMPTY,1);
   SetIndexArrow(1, 222);
   SetIndexBuffer(0, G_ibuf_84);
   SetIndexBuffer(1, G_ibuf_88);
    G_bars_100 = Bars;
    G_count_104 = 0;
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   if (CountBars >= Bars) CountBars = Bars;
   SetIndexDrawBegin(0, Bars - CountBars);
   SetIndexDrawBegin(1, Bars - CountBars);
   int ind_counted_8 = IndicatorCounted();
   if (ind_counted_8 < 0) return (-1);
   if (ind_counted_8 < 1) {
      for (int Li_0 = 1; Li_0 <= CountBars; Li_0++) G_ibuf_84[CountBars - Li_0] = 0.0;
      for (Li_0 = 1; Li_0 <= CountBars; Li_0++) G_ibuf_88[CountBars - Li_0] = 0.0;
   }
   for (int Li_4 = CountBars; Li_4 >= 0; Li_4--) {
      G_iadx_92 = iADX(NULL, 0, ADXbars, PRICE_CLOSE, MODE_PLUSDI, Li_4 - 1);
      G_iadx_100 = iADX(NULL, 0, ADXbars, PRICE_CLOSE, MODE_PLUSDI, Li_4);
      G_iadx_108 = iADX(NULL, 0, ADXbars, PRICE_CLOSE, MODE_MINUSDI, Li_4 - 1);
      G_iadx_116 = iADX(NULL, 0, ADXbars, PRICE_CLOSE, MODE_MINUSDI, Li_4);
      if (G_iadx_92 > G_iadx_108 && G_iadx_100 < G_iadx_116) G_ibuf_84[Li_4] = Low[Li_4] - 5.0 * Point;
   
   
      if (G_iadx_92 < G_iadx_108 && G_iadx_100 > G_iadx_116) G_ibuf_88[Li_4] = High[Li_4] + 5.0 * Point;
         
         
     
   
   }
   return (0);
}

Biantoro Kunarto
16659
Biantoro Kunarto  

You can use this :

int Shift = 1;
double UpArrow  = iCustom( Symbol(),PERIOD_CURRENT,"TurboEA",0,Shift);
double DownArrow = iCustom( Symbol(),PERIOD_CURRENT,"TurboEA",1,Shift);

if ( UpArrow > 0 ) Print("UpArrow");
if ( DownArrow > 0 ) Print("DownArrow");

If Shift = 0 means current candle

If Shift = 1 means previous candle

Muzaffar Ergashaliev
17791
Muzaffar Ergashaliev  
//OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO//
//+------------------------------------------------------------------+
//|  Get Signals                                                     |
//+------------------------------------------------------------------+
double SI(int buff,int shift){ return(iCustom(_Symbol,0,"TurboEA",ADXbars,CountBars ,buff,shift));}  
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH// 
//+------------------------------------------------------------------+
//| Get Entry Signals                                                |
//+------------------------------------------------------------------+
void Entry()

  
    Buy = (SI(0,sh) != EMPTY_VALUE && SI(0,sh+1) == EMPTY_VALUE);
  
    Sell= (SI(1,sh) != EMPTY_VALUE && SI(1,sh+1) == EMPTY_VALUE);  
     
}    
kiurire
177
kiurire  
Biantoro Kunarto:

You can use this :

If Shift = 0 means current candle

If Shift = 1 means previous candle

Thank you for your reply but i implemented your code but the EA still does not buy or sell when the arrows are drawn on the chart by the indicator
kiurire
177
kiurire  
Muzaffar Ergashaliev:
//OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO//
//+------------------------------------------------------------------+
//|  Get Signals                                                     |
//+------------------------------------------------------------------+
double SI(int buff,int shift){ return(iCustom(_Symbol,0,"TurboEA",ADXbars,CountBars ,buff,shift));}  
//HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH// 
//+------------------------------------------------------------------+
//| Get Entry Signals                                                |
//+------------------------------------------------------------------+
void Entry()

  
    Buy = (SI(0,sh) != EMPTY_VALUE && SI(0,sh+1) == EMPTY_VALUE);
  
    Sell= (SI(1,sh) != EMPTY_VALUE && SI(1,sh+1) == EMPTY_VALUE);  
     
}    
Thank you for your reply but where do i implement the code im kinda of  a beginner
To add comments, please log in or register