I am trying to improve my strategy by adding a new condition but I am not sure if it is even possible. So here is the condition logic:
I always set fixed entry price manually and I want my strategy to enter at the same level all the time, however in the cases like this(please see explanation below) i want to readjust my initial entry price:
Lets say my initial entry price was 2790 however price came to 2792 and bounced back where I missed my entry because price reversed 2 points away from my fixed entry price. So now I want to build a logic that if price will be within 5 points range from my entry price and if it does not reach my entry price within 2 15mins bar and I want my entry price to be readjusted 1 point up from the low of those 2 15mins candle.
private double entryPrice = 2790; // this is my original entry price
private double entryPriceAdjusted = 2795; // this is where price will go below 2795 and if price dont reach 2790 within 30mins (which is 2 15mins bar), I want to readjust my entry price to the low of 30mins again which 2 15 mins bar. lets say low of last 30mins was 2792 and I want my entry price to be readjusted to 2793 automatically when price comes back after 2 15mins candle close. However, if price gets executed within 30mins I want above logic to be not triggered at all. Also, I want to make sure when price is readjusted by meeting above condition, I want my initial entryPrice not to be triggered anymore in case next time price goes down.
I would really appreciate if you could please write a sample educational code for me to implement above logic.
Comment