Negative Bar usage in a Strategy

Posted By black Sunday, January 27, 2013
Add to Favorites0
Author Message
black
 Posted Sunday, January 27, 2013
Supreme Being

Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)

Group: Forum Members
Last Active: Sunday, July 13, 2014
Posts: 520, Visits: 1,004
What am I getting when I use a negative bar in a Strategy? It produces results in a Tester test.

For example:

var
OiBarNum: Integer;
OffInd: TIndicatorScript;

procedure OnCreate;
begin
OffInd := TIndicatorScript.Create(History, 'MA Y Shift', 'MA Y Shift');
Settings.AddInteger(@OiBarNum, 'OI Bar Number', -9);

procedure OnNewCandle;
begin
if (OffInd.GetGraph(0).Last(OiBarNum) < History.Last(1).Close)
then begin

This example produces Tester results. What are those results based on since an OiBarNum of -9 should mean 9 bars into the future? Does the ActTrader program automatically convert any future bar to 0 (zero)?

The results of the Strategy in the Tester are better with the future bar than they are with the present bar. What would happen if I Ran it Live?

Thank you.

Smile
Admin
 Posted Wednesday, January 30, 2013
Administrator

Administrator - (124,195 reputation)

Group: Administrators
Last Active: Friday, June 02, 2017
Posts: 548, Visits: 3,295
Dear Black,

actually trying of getting the indicator's value "from the future" will not return any applicable data - ActTrader does not convert future bar to zero bar.
When you try to get an unexisting data via some function - the ActTrader, like most of other programs, will
return "NaN" (Not a Number) value.
Therefore any mathematical or logical operations with NaN are unacceptable - the result will be unpredictable.

In your case the inequality returned "True" result, but this is not right logic, it's just random conduct.
Another time it may cause a crash of your strategy, so, please, be careful with that.


Best regards

-ACTFX© Forum Administrator
black
 Posted Thursday, January 31, 2013
Supreme Being

Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)Supreme Being - (96,525 reputation)

Group: Forum Members
Last Active: Sunday, July 13, 2014
Posts: 520, Visits: 1,004
Thank you, Admin. I will try to be careful.

I can see after several more tests that you are absolutely correct. The results are inaccurate, and maybe even of a random quality.

Thanks again.

Smile

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top