Setting flags

Questions about MultiCharts and user contributed studies.
jimdunn
Posts: 3
Joined: 11 Feb 2008

Setting flags

Postby jimdunn » 06 Mar 2008

I have a fairly complex signal. One of the things it does is set a flag equal to 1 if a stop loss is reached. Afterwards, it sets some of the input to a different amount based on the flag equaling 1.

My question is, does this flag get set for any stock that I am in that use this signal, even though they have not reached a stop loss.

kevin kolodzy
Posts: 64
Joined: 25 Jan 2008

Postby kevin kolodzy » 06 Mar 2008

Without actually seeing the code, I can't be entirely sure, but if your strategy code is applied to a stock chart and that stock's price movement does not satisfy the conditions for the stop loss, the flag would not be set.

You could also avoid setting the flag unless MarketPosition = 1 or -1 (i.e., Long or Short) and not set the flag if MarketPosition = 0 (flat), if that is your goal.


Return to “MultiCharts”