Hi
Seem to be unable to fathom this one out can anyone help? The following is stopping me out on the same candle as entry I’m sure its something simple and the code could be simplified:-
// first stops
if longonmarket THEN
DIFF = (close-Tenkansen)*pointsize
sl = (close-Tenkansen)*pointsize
set stop ploss sl
endif
if shortonmarket THEN
DIFF = (tenkansen-close)*pointsize
sl = (tenkansen-close)*pointsize
set stop ploss sl
endif
// dynamic change of stops
if longonmarket then
dynamicsl = sl
if (DIFF > dynamicsl) then
dynamicsl = DIFF
endif
endif
if shortonmarket then
dynamicsl = sl
if (DIFF > dynamicsl) then
dynamicsl = DIFF
endif
endif
I wrote a blog post about how to use an indicator value for an order stoploss. I think this is what you need for your project :
http://www.prorealcode.com/blog/learning/moving-stoploss-dynamic-informations-proorder/