This is not easy to be quick with
What is Candle(0)
What is HiLo(true,i)
and so on
I have tried to show code flow by using indentation so basically you have a number of if statements with conditions which if true lead into the next if condition true indent code if condition true indent code ...
if(Macd(i+1,1)<=0) { comm=comm+"\nNew Macd Crossover";//the condition can either be this } // added to simplfy else if( (Macd(i+1,1)>0) && (Close[i+1]<HiLo(true,i+1) ) && (Macd(i+2,1)<=0) ) { comm=comm+"\nMacd Crossover before first candle ";//or this }// added to simplfy if(Candle(i)<0) { comm=comm+"\nFirst Candle is bullish"; if(Close[i]<PivotLine("R2")) { comm=comm+"\nNot crossed R2"; if(Close[i]-(Pointnoreturn*Point*mno)<PivotLine(PivotResistLineName,i)-DistanceFromThePivot*Point*mno) { comm=comm+"\nFirst Candle at a distance "+MathAbs(Close[i]-(PivotLine(PivotResistLineName)-DistanceFromThePivot*Point*mno))/Point+" to the Near Pivot line"; if(Close[i]>=PivotLine(PivotSupportLineName,i)+DistanceFromThePivot2*Point*mno) { comm=comm+"\nNot too close to lower pivot "; if(Close[i]-(Pointnoreturn2*Point*mno)>BB("up",i)) { comm=comm+"\nClosed out of upper band"+d_str(Close[i])+" > "+d_str(BB("up",i)); if( Macd(i,0)>Macd(i,1) ) { comm=comm+"\nMacd is positive "+d_str(Macd(i,0))+" > "+d_str(Macd(i,1))+" "; if(Macd(i,1)>=0.1*Point) { comm=comm+"\nMacd signal is equal to or higher than "+d_str(0.1*Point)+""; if(Close[i]>HiLo(true,i)) { comm=comm+"\nCandle has broken resistance\nClose["+i+"]"+d_str(Close[i])+" > "+d_str(HiLo(true,i)); if(Rsi(i)<=(RsiBuyLevel)) { comm=comm+"\nCurrent Rsi "+d_str(Rsi(i))+""; //second candle if(Close[i-1]<Open[i-1]) { comm=comm+"\nSecond candle is bearish"; if(Atr(i-1)>=Atr(i)) { comm=comm+"\nAtr["+(i-1)+"]"+d_str(Atr(i-1))+" >= Atr["+i+"]"+d_str(Atr(i)); if(Macd(i-1,0)>=Macd(i,0)) { comm=comm+"\nMacd main is equal or greater"+d_str(Macd(i-1,0))+" > "+d_str(Macd(i,0))+" "; if(Macd(i-1,1)>Macd(i,1)) { comm=comm+"\nMacd signal is greater"+d_str(Macd(i-1,1))+" > "+d_str(Macd(i,1)); trade = -i; break;// have buy pattern } } } } } } } } } } } } }
if(Macd(i+1,1)<=0) { comm=comm+"\nNew Macd Crossover";//the condition can either be this } // added to simplfy else if( (Macd(i+1,1)>0) && (Close[i+1]<HiLo(true,i+1) ) && (Macd(i+2,1)<=0) ) { comm=comm+"\nMacd Crossover before first candle ";//or this }// added to simplfycould actually be
if(Macd(i+1,1)<=0) { comm=comm+"\nNew Macd Crossover";//the condition can either be this } else if( (Close[i+1]<HiLo(true,i+1) ) && (Macd(i+2,1)<=0) ) { comm=comm+"\nMacd Crossover before first candle ";//or this } else // or this

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
Hi
I am new to coding a I am struggling with these statement, bascially the conditions can either be one of the other not both, please see the first 2 conditions:
I cant seem to get it right as I get errors when compiling.
Thanks
Antony