Carl Schreiber hello, thank you for your answer...in global scope I have this:
int CountSell; double CloseSell; bool Sell;
after my first condition, I try in the 1500 candles counted from the for loop, the close[1+i] is repeated at least 20 times in the history.
if(iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) > 60
&& iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) < 80
{ Sell=false; CloseSell=Close[1+i]; CountSell=0; }
if(Sell == false){
for(int I=0; I<1500; I++){
if(CloseSell==Close[2+I]){
CountSell++;
Print("CountSell: "+IntegerToString(CountSell));
Print("Price :"+ DoubleToString(CloseSell)); }
if(CountSell==20) { I=1500; Sell=true; }
}
}
&& iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) < 80
{ Sell=false; CloseSell=Close[1+i]; CountSell=0; }
if(Sell == false){
for(int I=0; I<1500; I++){
if(CloseSell==Close[2+I]){
CountSell++;
Print("CountSell: "+IntegerToString(CountSell));
Print("Price :"+ DoubleToString(CloseSell)); }
if(CountSell==20) { I=1500; Sell=true; }
}
}
fly7680:
Carl Schreiber hello, thank you for your answer...in global scope I have this:
int CountSell; double CloseSell; bool Sell;
after my first condition, I try in the 1500 candles counted from the for loop, the close[1+i] is repeated at least 20 times in the history.
if(iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) > 60
&& iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) < 80
{ Sell=false; CloseSell=Close[1+i]; CountSell=0; }
if(Sell == false){
for(int I=0; I<1500; I++){
if(CloseSell==Close[2+I]){
CountSell++;
Print("CountSell: "+IntegerToString(CountSell));
Print("Price :"+ DoubleToString(CloseSell)); }
if(CountSell==20) { I=1500; Sell=true; }
}
}
&& iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) < 80
{ Sell=false; CloseSell=Close[1+i]; CountSell=0; }
if(Sell == false){
for(int I=0; I<1500; I++){
if(CloseSell==Close[2+I]){
CountSell++;
Print("CountSell: "+IntegerToString(CountSell));
Print("Price :"+ DoubleToString(CloseSell)); }
if(CountSell==20) { I=1500; Sell=true; }
}
}
Try like this :
if (!Sell) for(int i=0; i<1500 && (i+2)<Bars && CountSell<20; i++) if (CloseSell==Close[i+2]) CountSell++;
Sell = (CountSell==20);
Sell = (CountSell==20);
THANK Mladen Rakic, unfortunately works as my code, so no good .... I think the problem is in the 20 count.
The number 20, is also achieved if this is false:
if(CloseSell==Close[2+I])
and no correct!
A Little help please?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone, I created a small loop for, to try closures equal by using a counter. Unfortunately this Vieve count performed every tick, and I can not get an accurate count.
&& iCustom(NULL, PERIOD_CURRENT, "CCI", CCI_Periodo, 0, PRICE_CLOSE, i) < 80
{ Sell=false; CloseSell=Close[1+i]; CountSell=0; }
if(Sell == false){
for(int I=0; I<1500; I++){
if(CloseSell==Close[2+I]){
CountSell++;
Print("CountSell: "+IntegerToString(CountSell));
Print("Price :"+ DoubleToString(CloseSell)); }
if(CountSell==20) { I=1500; Sell=true; }
}
}