Hi,
I am using the finantic.Eval extension and would like to use tokens from the "LastPosition" category such as BarsHeld, EntryPrice, etc.
Unfortunately none of these seem to work.
Even very simple expressions like "BarsHeld > 3" fail. I have tried this in FxCondition, FxConditionOpt, FxSell and FxSellOpt blocks, but always get the same error:
"Could not compile the Strategy (null Executor)."
Am I missing something? Any ideas? All builds are up to date.
I am using the finantic.Eval extension and would like to use tokens from the "LastPosition" category such as BarsHeld, EntryPrice, etc.
Unfortunately none of these seem to work.
Even very simple expressions like "BarsHeld > 3" fail. I have tried this in FxCondition, FxConditionOpt, FxSell and FxSellOpt blocks, but always get the same error:
"Could not compile the Strategy (null Executor)."
Am I missing something? Any ideas? All builds are up to date.
Rename
Please use
If there are strange errors, klick the "Open as C# Coded Strategy" button.
In the "C# Coded Strategy" window click "Compile"
This will result in a more verbose error message.
If the reason is not obvious, please post the relevant lines of generated code and the error message here.
CODE:
LastPosition.BarsHeld > 3
If there are strange errors, klick the "Open as C# Coded Strategy" button.
In the "C# Coded Strategy" window click "Compile"
This will result in a more verbose error message.
If the reason is not obvious, please post the relevant lines of generated code and the error message here.
Thanks for the quick reply!
Your code proposal LastPosition.BarsHeld > 3 now works without throwing an error message. However, the result is quite different from what I expected.
I built a very simple system:
- Buy at Market (no further conditions)
- Sell at Market, with FxCondition, Formula: LastPosition.BarsHeld > 10

Now I get a lot of positions, but all of them are closed after just 1 bar. Only the very last position was held for 10 bars.

Is this the intended behavior? I expected something that works like the "Sell after N Bars" block or the "Bars Since Entry/Exit" block from the PowerPack. Or is there another possibility with Eval to achieve this result?
Your code proposal LastPosition.BarsHeld > 3 now works without throwing an error message. However, the result is quite different from what I expected.
I built a very simple system:
- Buy at Market (no further conditions)
- Sell at Market, with FxCondition, Formula: LastPosition.BarsHeld > 10
Now I get a lot of positions, but all of them are closed after just 1 bar. Only the very last position was held for 10 bars.
Is this the intended behavior? I expected something that works like the "Sell after N Bars" block or the "Bars Since Entry/Exit" block from the PowerPack. Or is there another possibility with Eval to achieve this result?
QUOTE:
Now I get a lot of positions, but all of them are closed after just 1 bar. Only the very last position was held for 10 bars.
That's because LastPosition... is always returning the LastPosition on the Chart rather than the LastPosition relative to the "current bar" for the simulation.
I have no idea how you reference the LastPosition of the "current bar" in blocks. I only know how to do it in code. You could write your strategy in code and it would work.
Thanks for explaining!
Your Response
Post
Edit Post
Login is required