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
Hey everbodys,
I need help to programm following problem;
The Trailingstopp should not follow the close-bid period for period..... (normaly)
The TS considering an art of bars, who have a small uncontrolled vola and which are in the red range caught.
until/if the next bar, which leave this range.
After that the TS can move on until the end the next Outbar or EXIT... (picture). Have anybody have an idea for an answer
The range is most an big bar (high/low-bid) untill the aktive bars closed! OUTSIDE this range......
Greetings!!
for long example!
if bar[0], close_price < bar[1] then TS move to bars[0] close_price
this bar[1] must be memory for the next inside bars! that ist the problem!
bar[1] = Outside_bar
.....
if bar[0], close_price > Outside_bar, closed_price
then TS can move to bars[1], closed price
short analog!
___
in the forum TRAILINGSTOP from ebeaupre I have found a interessed EA
Counted_bars=IndicatorCounted(); // Number of counted bars
i=Bars-Counted_bars-1; // Index of the first uncounted
while(i>=0) // Loop for uncounted bars
{
trailup=trailvalue;
if(Close[0]==Close[1]) //Price doesn't change
{
trailup=trailup1;
}
if(Close[0]<Close[1] && trailup1<(Close[1]-Close[0])) //Price declining below stoploss, Stopped out and reset
{
trailup=0;
}
if(Close[0]<Close[1] && trailup1>(Close[1]-Close[0])) // Price declines but not to stop loss level, stop remains in place
{
trailup=trailup1-(Close[1]-Close[0]);
}
if(Close[0]>Close[1] && trailup1+(Close[0]-Close[1])>trailvalue*Point) // Price moves up when and moves stop loss up
{
trailup=trailvalue;
}
if(Close[0]>Close[1] && trailup1+(Close[0]-Close[1])<trailvalue*Point) // Price moves up but not enough to move stop
{
trailup=trailup1+(Close[0]-Close[1]);
}
trailup1=trailup;
Buf_0[i]=Close[0]-trailup; // Value of 0 buffer on i bar
i--; // Calculating index of the next bar
}