how to setup condition which change another condition in strategy?
Hello guys, I am struggling finish my automatic strategy. Strategy is nearly done, just missing one last step. Hope it will be more clear from picture
I have a strategy which works with 3 indicators.
One shows me high/low till 15:30
Second shows me high/low of a day.
third shows me EMA slope (green, grey, red)
Situation 1:if ema slope is green-> if open> "high till 15:30 "= buy signal
Situation 2:if ema slope turns red -> since that time if open > high of a day = buy signal.
If EMA slope is green whole day, my entries are based on "high till 15:30" whole day.. But if Ema slope turns red (at least once, no matter if it turns back to green again) - since that moment entries only: if open > "current high of day" = buy signal(no high till 15:30 anymore...
my problem is that I do not know how to code that change. Basically - if indicator EMA slope turns red, I need to replace order (if open> "high till 15:30 "= buy signal) by order (if open > "current high of day"= buy signal).
Hope it makes some sence what I am trying to code. Will be glad for any advice.
Concrete codes for my strategy:
1. "If open> high till 15:30 -> buy"(that is what I want until some indicator change does not appear)
if (Open >= HiLoOfTimeRange_WithTargetNT7(8, 0, 15, 30, 0, 0).TheHigh
&& EMA (100) > EMA(200)
&& Open > EMA(100)
&& ToTime(Time) >= ToTime(15, 30, 0)
&& ToTime(Time) <= ToTime(21, 30, 0))
EnterLong(DefaultQuantity, "high breakout");
2. "indicator change". If that condition appears, it will trigger a change.
Thank you for your advice, I will definitely do some research. To be honest, I am not very good with Ninjascript and never heard about boolean flags before. Do you know any code, or example how it works and how to use it in coding? I will try my research anyway hopefully will find some info. Thank you for your advice once again anyway!
Like rleplae suggests reading that thread will definitely hep you learn many things and you should.
Basically if you are going to get to code, you need to have a basic idea of syntax and programming or every small obstacle will tire you. If you haven't gone through NinjaTrader Version 7 please go through to begin with.
In your case in the variable section declare the following: