Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 03:43:44 +0000



Post From: Help with creating "Stop Graph" in custom study

[2015-12-11 06:01:29]
cazeek - Posts: 33
Hello, I apologize in advance that this may be a bit complicated. I am just starting figuring out how to code a study.

I need two lines in my chart to indicate where my stops are. The rule is:

Once BUY is entered, I will need two lines representing the stop levels:

LINE 1:
Stop1 (trailing, recalculated daily): Maximum(ClosePrices(tradedate -> today)) - 4 x Average True Range
Stop2 (fixed): Open Price - 3 x Average True Range
I want first line graphed to show whichever is greater, Stop1 or Stop2.

This line will be a stop that is 3 ATRs below the open price of the BUY date. Once the close price - 4 ATRs is greater, the stop will move up with the value of that. One other condition is I don't ever want the Stop price to move down. So if ATR spikes and causes close price - 4 ATRs to be lower than the day before, I want to use the prior highest stop.

Essentially, I just want a fixed stop that eventually turns into a trailing stop.

The second line will be a little different, but if you can help me with this one, I will be able to figure it out.

Thanks so much