Quick question. If I want to save an actual RT Trade Price in a Static Array then obviously the trade happens at the last BarIndex. As time moves on and I recall my Trade Price using StaticVarGet for plotting, it will auto-pad my array and I get a Trade Price in every BarIndex after the BarIndex where the trade actually took place. Basically the Auto-Padding causes this and how do I remove that?
I think you should share the code that you are using. Your code may not be right.
I tried doing it this way in real time for the last bar.
bc = BarCount - 1;
a = StaticVarGet( "MyArray" ); // store Array in temp
// update last bar Only
a[bc] = LastValue( C ); // or your trade price
StaticVarSet( "MyArray", a, True); // Save the Array again
Other values in the Array at different Timestamp will not get disturbed in the same timeframe.
Very old bars may not get stored as Bar count changes with QuickAFL so you need to check this along with your other code.
Put this bit of code only when your trade is triggered.
Another way i found in the help is to use StaticVarAdd() with keepAll = True and you can still still add the Price value to temp array initialized with 0 and only use index element at last location.
You can try this.