Thanks for your note.
In the code you shared in post # 13 and post #11, you are using mySeries[0] = (Volumes[0])*-1;. This would not be the correct syntax for subtracting a value from another value. You would need to use the -= operator instead to subtract the volume from your variable.
For example, x -= y would read as x = x - y.
To add one value to another value, the += operator should be used.
For example, x += y would read as x = x + y.
SUM() will add up all values of the Series<double> variable for the period provided. If you pass in a period of 5, it will add up the past 5 Series<double> values together and return the total of those 5 added variables.
You would need to add debugging prints to the script that print out each value you are accessing in your script's calculations to see exactly what value you are accessing in your script and how your logic is evaluating based on those values.
Below is a link to a forum post that demonstrates how to use prints to understand behavior.
https://ninjatrader.com/support/foru...121#post791121
Ultimately, it will be up to you to come up with the exact logic and debug the script to accomplish your specific goal.
Let me know if I may assist further.


Comment