Help with plotting of a trailing stop

Questions about MultiCharts and user contributed studies.
Adam333
Posts: 20
Joined: 05 Oct 2010

Help with plotting of a trailing stop

Postby Adam333 » 12 Oct 2010

Can someone please give me some assistance on how to go about plotting a trailing stop for a corresponding position a strategy has on?

I cannot figure this out as plotting has to be done from within an indicator, but from within an indicator "MarketPosition" is not accessible.

Thanks
Adam

sptrader
Posts: 633
Joined: 09 Apr 2010
Location: Colorado
Has thanked: 394 times
Been thanked: 236 times
Contact:

Re: Help with plotting of a trailing stop

Postby sptrader » 12 Oct 2010

For indicators they have a special function for market position called
i_marketposition.

Adam333
Posts: 20
Joined: 05 Oct 2010

Re: Help with plotting of a trailing stop

Postby Adam333 » 12 Oct 2010

Thank you.

Any idea how to reference highest or lowest close since entry in an indicator? I am having issues with this as reserved word "barssinceentry" cannot be referenced from within an indicator like in the code below...


plot1(Highest(close, barssinceentry) - (ATR * ATRStop), "Trailing Stop");


Thanks in advance,
Adam

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Help with plotting of a trailing stop

Postby Dave Masalov » 13 Oct 2010

Dear Adam,

barssinceentry cannot be used in indicators, so you will need to define the bar on which the entry occurred using the analysis of market position change: i_marketposition.

Adam333
Posts: 20
Joined: 05 Oct 2010

Re: Help with plotting of a trailing stop

Postby Adam333 » 13 Oct 2010

Ok thanks Dave

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Re: Help with plotting of a trailing stop

Postby Dave Masalov » 14 Oct 2010

Dear Adam,

You are welcome.


Return to “MultiCharts”