Trading is not like playing with slot machines. The question how to enter or exit a position when "the color changes" is not very professional. Also you should not try to access color objects in NinjaTrader, but rahter access the underlying condition.
A color change of a Heikin Ashi bar may signal a change in the underlying trend. Now you did not specify which version of the Heikin Ashi bars you intend to use. Let me assume that you use standard NinjaTrader Heikin Ashi bars. In that case there are 3 different color states
- upclose: close > open
- downclose: close < open
- doji: close = open
You can check for these conditions via the strategy builder.
I have coded an enhanced version of the HeikinAshi indicator, which you can find here:
The indicator has the trend (uptrend or downtrend) exposed as a BoolSeries. You can access this BoolSeries directly via code. However, the strategy builder cannot access the BoolSeries, but would require a DataSeries object instead.
I do have a modified version which has the BoolSeries replaced with a DataSeries. The DataSeries can hold the value + 1 (for uptrend) and - 1 (for downtrend), and it can be directly accessed via the strategy builder. So all you would need to do is to check for a change of that value. Please let me know, if you wish to use the modified version of the indicator, and I will post it.
The following user says Thank You to Fat Tails for this post:
Thank you for replying to my question. Indeed i might not come across professional just because i am not professional.
I am also very rusty on my C++, C# is new. So therefor i can only appreciate your reply even more, thank you.
Also thank you for the indicator to download and the tip on the BoolSeries, i will try them both.
Thank you for your reply and information. I very much appreciate that you have taken the time to educate me and to show how it would be written. Indeed i am using ninjatrader, sorry to mention that. Your clarification is very educational and can't wait to try to implement it. Thank you!
The following user says Thank You to OWLTC for this post:
heikin ashi close = average of high low close open of current standard candlestick bar or hi low open close bar
heikin ashi open = average of close and open of last heikin ashi bar
so the heiken ashi close value depends on what just happened in the current period
and the heikin ashi open value depends of what happened on the last period.
Thus a heikin ashi bar is not dependent on the future period?? In short, it is not cheating. Reason I asked, is I had a spread sheet formula that showed a fantastic profit loss result. What happened was I was using the current hi low values to put a position on at the open.
Hell, then why not sell at the high and buy at the low since I knew at the open what the high and low was going to be?
The following user says Thank You to thailerdurden for this post: