Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
Posts: 171 since Aug 2009
Thanks: 99 given,
Execute trade intrabar on bar close indicator
I have a programming question. I am using the Swing indicator built into NinjaTrader to go Long as soon as it is 1 tick above the swingHigh, or go Short as soon as it is 1 tick below the swingLow.
This obviously needs to be done CalculateOnBarClose = false; to enter the trade intrabar
However, now the indicator is being calculated on bar close = false;
I just wanted to know the best way to have a strategy that has the entry for OnBarUpdate when I need:
goLong/goShort-------> needs to be CalculateOnBarClose = false;
Swing(5) indicator--------->needs to be CalculateOnBarClose = true;
Do I create 2 separate methods?
here is my code so far:
The only other thing I can think of is use the indicator on the chart and have a FileWriter write the Swing High, Swing Low to a swingLow.txt and swingHigh.txt and then the Strategy uses these .txt files. However, I am thinking this might cause delays, but not sure, etc...
The other way can be using a data structure like ArrayList or something on an indicator page, and then the Strategy page reads the return.
Then the strategy can grab this
BTW, my most comfortable programming language is Java, so it is taking a little while for me to learn C#----not that bad, just trying to relate how things are done differently-----like with get, and set
If your "calling" indicator or strategy (the one added to your chart) is set to COBC = false, then anything other than COBC = false in all the child indicators will result in problems. The best thing is to remove COBC from #init altogether, which means it defaults to true, unless the parent is false in which case it defaults to false.
It is not possible to have the parent be different than the child and get correct results. Not in any of my experiences at least.
If you need this, you would have to simulate it yourself. Run everything COBC false, then code a function to simulate filling your dataseries or whatever based on COBC true. I've had to do this several times.
Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.
Need help? 1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first. 2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses. 3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make. 4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance. 5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers. 6) Help using the forum? Watch this video to learn general tips on using the site.
If you want to support our community, become an Elite Member.
The following 2 users say Thank You to Big Mike for this post:
Favorite Futures: ES, Stocks, European index futures
Posts: 1 since Aug 2011
Thanks: 1 given,
The million dollar question I'm trying to answer, and it seems you may be up to something already, is how exactly would I code a function to simulate filling my dataseries?
An example of that would prove very useful to me, I've been straining my brain for a reliable solution for ages...