I am looking to create a strategy in which when certain conditions are met, a trade is taken either in buy or sell side. I want to set stoploss as signal’s previous candle’s low or high depending on whether it is buy or sell trade. I tried searching the forums but have had no luck in deploying this. Can someone please help me?
Ex.:
Time frame: 5 mins
if sell signal is initiated in between 9:50-9:55 candle, the stoploss should be high of 9:45-9:50 candle.
Similarly, if sell signal is initiated between 10:25-10:30 candle, the stoploss should be high of 10:20-10:25 candle
puneet
Hello Chirag
if the entry candle time is known then ORB with the previous time high and low can be used as stoploss
Chirag Gada
The problem with ORB is that the time for ORB range will be fixed. My trade can get initiated anytime during the day and its SL will be entry candle’s previous candle high or low.
JAI
Any update for this question, looking for same solution.
Need to place exit based on EntryTime candle High or Low based on Long/Short
mankerajedra
This can be achieved now by using Runtime Variables
Chirag Gada
can you help how can I define that?
Shailesh Bind
can u explain plz how to use runtime variable
Abhijit Bhattacherjee
Under runtime, use traded instrument to capture high and low value of that candle. So there will be 2 variable. In your exit condition, you use those variable.
kali_om
Can you pls explain in detail
Rudresh
When you take the position, create 2 runtime labels. One for high and other for low. Use position keyword with 5 min time frame and store the -1 candle high and low values
Tradetron TeamTradetron team
Use runtime variables to store the signal candle’s high and low when the trade is taken (replies #8–#10 are on the right track).
In the entry block’s Runtime section, add:
sl_high = Position(HIGH(<symbol, 5m>), -1)
sl_low = Position(LOW(<symbol, 5m>), -1) -1 is the last closed candle before entry, which is the candle you described.
These are written once, right after the entry leg is taken, so they do not move later.
Set Exit, long trade:LTP(<symbol>) < Get Runtime Number(sl_low). Short trade:LTP(<symbol>) > Get Runtime Number(sl_high).
Use separate sets for long and short, each with its own variables.