Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
Posts: 171 since Aug 2009
Thanks: 99 given,
OnBarClose true for indicator false for strategy
I am trying to figure out how to program a strategy with the following criteria:
Uses an Indicator that is OnBarClose = True
Then, for example, we will use the Swing indicator in NinjaTrader for this example:
On the 1 min chart of ES, we have the Swing indicator. Let's say we go long when the price
which is OnBarClose = False
So, we have a strategy that enters based on OnBarClose = False and takes its entry off of an
indicator that OnBarClose = True.
I also think that there would only be one value for swing high, and one value for the swing low --- the last most recent value. So, the only thing I can think of is storing the value like
in an indicator I create called "ESSwinger" or something that specifically is reading the Swing values. Then, in my strategy I would import the ESSwinger, but then I realize that each chart itself has its own environment of OnBarClose = True or False or is it possible to configure the General part of the chart settings in the #region properties?
Or do I need 2 charts: 1 running the Swing indicator and saving the last value of bullish and bearish, and the strategy which just looks at the last current value and if price goes above the swingHighLevel by 1 tick, GoLong set ATM strategy
if price goes below swingLowLevel by 1 tick, GoShort and set ATM strategy
I am not clear on the best way to implement this.
I even thought about exporting values to txt, but then I don't want to run into concurrency problems of constantly checking (opening and closing the txt file) by the OnBarClose = false and then trying to write the data each minute from the other one.