Try This
heres how i would approach the problem:
double cci = iCCI(.....);
double ccistop, lastccistop;
if(OrderType()=OP_BUY){
ccistop = cci - 20;
if(ccistop > lastccistop)
{
lastccistop = ccistop;
}
if(lastccistop>=cci){
OrderClose(.....);
}
}
if(OrderType()=OP_SELL){
........... etc.
}
I dont know if thats correct I just thought of that right know.
hope that helps,
Mikhail
Need some help coding this....
I am trying to measure the Highest/lowest level of the CCI and use it as a "trailing stop".
for example if I am in a long position and the CCI peaks out at 250 I want to exit the position when it comes down to 240.
I have made it work by using 50 different levels and just saying when CCI is higher than level N and comes back down to N. but this is very inefficent.
What i need is a way to store the value of the Highest CCI level . Anyone here know how to do this ?
Thanks,
KKThanks,
But It only works once. I need to reset it after the function is completed. How would you do that?
heres how i would approach the problem:
double cci = iCCI(.....);
double ccistop, lastccistop;
if(OrderType()=OP_BUY){
ccistop = cci - 20;
if(ccistop > lastccistop)
{
lastccistop = ccistop;
}
if(lastccistop>=cci){
OrderClose(.....);
}
}
if(OrderType()=OP_SELL){
........... etc.
}
I dont know if thats correct I just thought of that right know.
hope that helps,
MikhailThanks, But It only works once. I need to reset it after the function is completed. How would you do that?
than put somethig in the begginning of your code that resets the varables.
like:
if (orderstotal()<1)
{
lastccistop = 0;
}
there that should do it... I suggest you make those variable global vars.
Kind regards,
Mikhail

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Need some help coding this....
I am trying to measure the Highest/lowest level of the CCI and use it as a "trailing stop".
for example if I am in a long position and the CCI peaks out at 250 I want to exit the position when it comes down to 240.
I have made it work by using 50 different levels and just saying when CCI is higher than level N and comes back down to N. but this is very inefficent.
What i need is a way to store the value of the Highest CCI level . Anyone here know how to do this ?
Thanks,
KK