I've updated each instance of the PositionAccount.AveragePrice in the code.
Now it's working! You rock! Thanks a lot!
The stop is set 1st 30 ticks below the correct Long entry price.
And then upon condition met the stop moves to Long Entry Price + 1 tick as indented in the test.
Full code:
Thanks for the recommendation
From the tests done so far I understand that Position is for the managed strategies only.
Basically the Position method manages orders that are not unmanaged (it detects the managed order's properties on its own).
While PositionAccount is for the Unmanaged strategies.
Basically the PositionAccount method manages orders that are unmanaged (it detects the unmanaged order's properties on its own, if and only if we add the 'Account' to Position.AveragePrice).
Is there something more to that to understand?
Is there a special documentation about it?
I found more example from the PositionsAccount page:
{
Print("ES account position is " + PositionsAccount[0].MarketPosition);
Print("NQ account position is " + PositionsAccount[2].MarketPosition);
// Alternative approach. By checking what Bars object is calling the OnBarUpdate()
// method, we can just use the Position property since its pointing to the correct
// position.
if (BarsInProgress == 0)
Print("ES account position is " + PositionAccount.MarketPosition);
else if (BarsInProgress == 2)
Print("NQ account position is " + PositionAccount.MarketPosition);
}
I see now we can Print the PositionAccount.MarketPosition value.
I'll test it.
Next I'll add the Short Side Logic and be back asap.
Thanks again a lot!
Leave a comment: