My strategy sends both stop and limit orders once a position is initiated.
How can I know, using Easylanguage, whether the last exit was done with the stop or the limit order?
Can you help answer these questions from other members on futures io?
you can for example use the OrderFill method of the StrategyHost object to obtain the type or name of a filled order.
In legacy Easylanguage you could use the exit price to calculate what exit order resulted in the exit.
In Multicharts you could use ExitName or PosTradeExitName to obtain the name of the exit - which in turn should enable you to know if the stop or target was hit.
Regards,
ABCTG
The following user says Thank You to ABCTG for this post:
I'm using Multicharts. ExitName looks suitable. Regarding PosTradeExitName, I found info in PosTradeExitName - MultiCharts but don't understand the second parameter there.
you are welcome. The second parameter is the trade number, which comes into play when you handle multi leg positions. Assume you scale into a long position with three entries, you can access each of these legs (with using the values 0 to 2 for the second parameter). Keep in mind that it's zero based, so the first trade into each position has the trade number 0.
To access the total number of trades for a position you can use the PosTradeCount reserved word.
Regards,
ABCTG
The following user says Thank You to ABCTG for this post: