
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
I'm working in a trainling stop system, wich must follow the Low and High prices and return me if should i close or not some orders. The problem is that it works, but after some candles/bars it stops. I know that there is a stop order, that we can send using the order, but it have a minimal pip, and thisone that i'm working on,is controlled by my computer and i guess that it'll giveme a better precision in my orders.
Here's my code:
if(modo == 1 && operacao == OP_BUY){
if(StopAnterior == 0.00000){
StopAnterior = Low[anteriores];
}
if(StopAnterior > Low[anteriores-1]){
StopAnterior = Low[anteriores-1];
}
if(StopAnterior > Low[0]){
StopAnterior = Low[0];
}
Comentarios[7] = "Low Stop: "+StopAnterior;
DrawHLine("stop",StopAnterior,Blue,STYLE_DOT);
if(Low[0] > StopAnterior){//Se tiver rompido o stop
StopAnterior = 0.00000;//zera marcador
return(true);
}
}
if(modo == 1 && operacao == OP_SELL){
if(StopAnterior == 0.00000){
StopAnterior = High[anteriores];
}
if(StopAnterior < High[anteriores-1]){
StopAnterior = High[anteriores-1];
}
Comentarios[7] = "Stop: "+StopAnterior;
DrawHLine("High stop",StopAnterior,Blue,STYLE_DOT);
if(High[0]<StopAnterior){//Se tiver rompido o stop
StopAnterior = 0.00000;//zera marcador
return(true);
}
}
return(false);
}
I don't think that there's an error in the code, but if someone could help, i would be thankful =)