Indicator buffer values
-
Hi, I use indicator from My indicators. The indicators test shows two out put buffers. Indicator values are double: 0 and 1. In condition block I use indicator value 0 and on the right side value == 0. I put ea on testing and add indicator with the same values as EA. Indicator works as I should, bet ea probably didnt pick up this value from indicator. Anu help please.
-
We have just two output buffers I need:
double up[], dn[]
and condition 1:
if ( dn[1] != 0 ) and
condition 2 :
if ( up[1] != 0 )
In condition block:
left side: My indicators/my indicator/Indicator mode (buffer) value 0:Downpinbar
right side: != Value/numeric/=0EA doesnt pick up indicator values.
The code is pretty simple :
#property copyright "smjones" #property link "" #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Aqua #property indicator_color3 White #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 1 extern bool AlertOn = true; extern int Offset = 10; extern double PBRatio = 0.8; //extern double PBTail = 0.25; //extern int TailBarsBack = 2; extern double Entry = 0.50; datetime alertonce = 0; double up[], dn[], ExtMapBuffer1[]; int mult = 1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators if (Digits == 3 || Digits == 5) mult = 10; SetIndexBuffer(0,dn); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0, 234); SetIndexLabel(0,"Down PinBar"); SetIndexBuffer(1,up); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1, 233); SetIndexLabel(1,"UP PinBAR"); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,119); SetIndexBuffer(2,ExtMapBuffer1); SetIndexLabel(2,"EntryPoint"+DoubleToStr(Entry*100,2)+"%"); //---- return(0); } //+----------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- Comment(""); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double range,pb,tail; int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; for(int i=0; i<limit; i++) { up[i] = 0; dn[i] = 0; ExtMapBuffer1[i] = 0; } for( i=0; i<limit; i++) { range = High[i+1]-Low[i+1]; pb = range * PBRatio; //tail = range * PBTail; if ( Open[i+1] >= High[i+1]-pb && Close[i+1] >= High[i+1]-pb) // && Low[i+2] > Low[i+1]+tail && Low[i+1] < Low[iLowest(NULL,0,MODE_LOW,TailBarsBack,i+2)] ) { up[i+1] = Low[i+1] - Offset*Point*mult; ExtMapBuffer1[i+1] = High[i+1]-((High[i+1] - Low[i+1]) * Entry); } if ( Open[i+1] <= High[i+1]-(range-pb) && Close[i+1] <= High[i+1]-(range-pb)) // && High[i+2] < High[i+1]-tail && High[i+1] > High[iHighest(NULL,0,MODE_HIGH,TailBarsBack,i+2)] ) { dn[i+1] = High[i+1] + Offset*Point*mult; ExtMapBuffer1[i+1] = ((High[i+1] - Low[i+1]) * Entry) + Low[i+1]; } } if ( AlertOn && alertonce!= Time[0] ) { if ( dn[1] != 0 ) { Alert(Symbol(), " M",Period()," Sell Pin Bar @ ", DoubleToStr((High[1]-Low[1])*Entry+Low[1],Digits), " ", TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS) ); alertonce = Time[0]; } if ( up[1] != 0 ) { Alert(Symbol(), " M",Period()," Buy Pin Bar @ ", DoubleToStr(High[1]-((High[1]-Low[1])*Entry),Digits), " ", TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS) ); alertonce = Time[0]; } } //---- //---- return(0); } //+------------------------------------------------------------------+ -
try block Trace for your buffers in indicator tester and you will see buffers behavior with values
