is there any way how could i be in 2 contracts in same time and then leave only the specific-one contract wich i want??
i will explain...
I tried something like this
in initialize:
{
CalculateOnBarClose = true;
ExitOnClose = true;
Add(PeriodType.Tick, 1);
EntriesPerDirection = 10;
EntryHandling = EntryHandling.AllEntries;
}
and then in OnBarUpdate
EnterLong("long1"); - this was entered in this position at 9AM
EnterLong("long2"); - i called this at 10AM
so now it is 1pm and i am in two different open positions in the same time.. great. And now i want to exit position long2. So i called ExitLong("long2");
But NinjaTrader will exit the position which i opened at 9am (position long1).
But thats wrong. What i wrote wrong? something in initialize?
Is there even any way how could i realize this idea in code?
This exiting only the specific open positions?...
And my other question.. it is possible to be in long position and short position at the same time?
For example... its 9am and i want to enter to long position..
then it is 11am and i want to enter to short position but i want to have open the contract from 9am (the long position)
..when i am programming in ninjascript any trading systems for backtest always i could be only in short or only in long.
When i have open any long position and then i call EnterShort(); it will close all my long position and open short. But i want to have theese long positions still open until i will call ExitLong(); or something..
Thank you for your help

thank you...
Comment