Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 10:35:58 +0000



Post From: Code help, using a string instead of a constant

[2023-08-28 16:47:44]
User431178 - Posts: 544
I have it working for historical bars, but I can't get it to work for the current updating bar. As far as I understand it should be calculating correctly for all bars up to the last one but for some reason it isn't. Don't know what I'm missing.

Please see the second code example posted above.

this
bool ParseAndSetFormula = sc.IsFullRecalculation;
and

if (BarIndex == 0)
FormulaOutput = sc.EvaluateGivenAlertConditionFormulaAsDouble(BarIndex, ParseAndSetFormula, Formula); // Evaluate the formula
else
FormulaOutput = sc.EvaluateGivenAlertConditionFormulaAsDouble(BarIndex, 0, ""); // Evaluate the formula

Mean that the formula are parsed and set only during a full recalculation and only at bar index 0.
As you are cycling through various formula, you will need to parse and set each time, otherwise only the last set formula is applied.