Posted By: madpower2000
How calculate price difference with adviseLong() in right way? - 11/23/16 19:35
Hi
Can’t figure out, how adviseLong() calculate price difference
I run this code:
// Run the script in [Train] mode with asset EUR/USD selected
function run()
{
StartDate = 20140601; // just one day
EndDate = 20140602;
BarPeriod = 60; // use 1-hour bars
set(RULES); // generate signals
LifeTime = 1; // prediction horizon ONE bar
Spread = RollLong = RollShort = Commission = Slippage = 0;
adviseLong(SIGNALS,0, priceClose(), priceClose(1));
enterLong();
}
With LifeTime = 1, our target is the return of next bar trade. Trading costs are set to zero, so in this case the return is equivalent to the price difference just one bar in the future, right?
But after comparing price difference between reference bar and adviseLong() output – it’s not identical as supposed to be. (see attached compare table)
Can’t figure out, how adviseLong() calculate price difference
I run this code:
// Run the script in [Train] mode with asset EUR/USD selected
function run()
{
StartDate = 20140601; // just one day
EndDate = 20140602;
BarPeriod = 60; // use 1-hour bars
set(RULES); // generate signals
LifeTime = 1; // prediction horizon ONE bar
Spread = RollLong = RollShort = Commission = Slippage = 0;
adviseLong(SIGNALS,0, priceClose(), priceClose(1));
enterLong();
}
With LifeTime = 1, our target is the return of next bar trade. Trading costs are set to zero, so in this case the return is equivalent to the price difference just one bar in the future, right?
But after comparing price difference between reference bar and adviseLong() output – it’s not identical as supposed to be. (see attached compare table)