Try adding (Outside of any if() condition)
if(Buffer[0]!=0) Buffer1[0] = Low[0] - 3 * myPoint);
Hello GumRai, thanks for the reply.
I tried to do as you suggested, but definitely something wrong. I stated Buffer as Array and I entered the condition outside any if () condition. Where am I wrong?
int start() { static datetime BarStart=0; static bool check=false; if(BarStart!=Time[0]) { BarStart=Time[0]; check=true; } if(check && TimeCurrent()>=Time[0]+3) { check=false; if(Buffer[0]!=0) { Buffer1[0] = Low[0] - 1 * myPoint; } //Indicator Buffer 1 if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) < 50 ) { Buffer1[0] = Low[0] - 3 * myPoint); } else { Buffer1[0] = 0; } } return(0); } //-----------------------------------------------------------------------------------------------------------------------------
Excuse me but I am a neophyte. This is the result you get
I thank you for the answer, Max.
Hello GumRai, thanks for the reply.
I tried to do as you suggested, but definitely something wrong. I stated Buffer as Array and I entered the condition outside any if () condition. Where am I wrong?
Excuse me but I am a neophyte. This is the result you get
I thank you for the answer, Max.
No you did not. It is inside the if condition
if(check && TimeCurrent()>=Time[0]+3)
static datetime BarStart=0; static bool check=false; if(BarStart!=Time[0]) { BarStart=Time[0]; check=true; } if(check && TimeCurrent()>=Time[0]+3) { check=false; //Indicator Buffer 1 if(iRSI(NULL,PERIOD_CURRENT,Period1,PRICE_CLOSE,0)<50) { Buffer1[0]=Low[0]-3*myPoint; } else { Buffer1[0]=0; } } if(Buffer[0]!=0) { Buffer1[0]=Low[0]-1*myPoint; }
Thanks, Max.
I just noticed
if(Buffer[0]!=0) { Buffer1[0]=Low[0]-1*myPoint; }
should be
if(Buffer1[0]!=0) { Buffer1[0]=Low[0]-1*myPoint; }
..
Thanks for your patience, Massimo.
This is the code I used:
int start() { static datetime BarStart=0; static bool check=false; if(BarStart!=Time[0]) { BarStart=Time[0]; check=true; } if(check && TimeCurrent()>=Time[0]+Ritardo_Secondi) { check=false; //Check Condition //_________________________________ //Indicator Buffer 1 if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) < 30 ) { Buffer1[0] = Low[0] - 1 * myPoint; } else { Buffer1[0] = 0; } if(Buffer1[0]!=0) { Buffer1[0]=Low[0]-1*myPoint; } //Indicator Buffer 2 if(iRSI(NULL, PERIOD_CURRENT, Period1, PRICE_CLOSE, 0) > 70 ) { Buffer2[0] = High[0] + 1 * myPoint; } else { Buffer2[0] = 0; } if(Buffer2[0]!=0) { Buffer2[0]=High[0]+1*myPoint; } } return(0); }
Once again you have put your highlighted code inside the block of code controlled by
if(check && TimeCurrent()>=Time[0]+Ritardo_Secondi)
.
Thanks again for your patience and professionalism.
Greetings, Massimo.
int start() { if(Buffer1[0]!=0) { Buffer1[0]=Low[0]-1*myPoint; } if(Buffer2[0]!=0) { Buffer2[0]=High[0]+1*myPoint; } static datetime BarStart=0; static bool check=false; if(BarStart!=Time[0]) { BarStart=Time[0]; check=true; } if(check && TimeCurrent()>=Time[0]+3) { check=false; //Check Condition //_________________________________ //Indicator Buffer 1 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) < 30 ) { Buffer1[0] = Low[0]; } else { Buffer1[0] = 0; } //Indicator Buffer 2 if(iRSI(NULL, PERIOD_CURRENT, 2, PRICE_CLOSE, 0) > 70 ) { Buffer2[0] = High[0]; } else { Buffer2[0] = 0; } } return(0); } //+------------------------------------------------------------------+
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone. I need help to solve a problem on the distance of the arrows from the candles.
I have these two codes:
With this code, the distance between the arrows and candles remains constant and that is fine.
With your help I have written this code which evaluates the alert after a few seconds from open candel.
This is the code that I would use:
But with this code, the arrows often enter into the candle. you can resolve this problem by keeping constant the distance arrows / candle?
Thank you all, Massimo.