Thanks for your reply.
In your set two, the likely issue is that in EnterLongStopMarket(0,true,1,bwFractal1.Upper[3], "EntryFractalupper"); on each bar you are accessing bwFractal1.Upper[3] which may not have a fractal value on a given bar. You should instead be using the saved variable value of Up which should have the fractal value.
If you want to use the IsLiveUntilCanceled then you need to add further code so that you can cancel that order if/when needed as it will in that case not be automatically canceled. Here are links to further assist you with creating orders that can be canceled:
https://ninjatrader.com/support/help...ancelorder.htm (Please review the example in the help guide)
https://ninjatrader.com/support/help...thod_to_ca.htm (This is an example strategy that demonstrates the cancel order process).
Another alternative, instead of using limit orders you can create the condition of checking to see if price crosses above the fractal level and if so then use EnterLong() which is a market order. In a set, you would then check to see if you are flat and check that a price type (High, Low, Close, Open, weighted, or median, has CrossAbove, the right side would be the variable Up. The action would be EnetrLong().
If you use variables as I have advised in post #13 you can continue working in the strategy builder which, while confining in some respects is also convenient in others. I Understand you have unlocked so you cannot use that particular file so you would have to create a new one.
To answer your question about an array, this is more of a C# question and we generally will refer you to seek C# answers via the internet search. However, in the interest of time, you would have to create a private array like this:
At the class level: private double [] UpFractals;
In State.DataLoaded: UpFractals = new double[3]; // determine how many values to store and use that number, 3 is shown as an example.
You can then use the Array as needed in OnBarUpdate().
Comment