Hi All,
I am using a multitimeframe strategy. I want to print in output with messagelog the values of a variable at each order. I have intrabar order generation enabled.
So in each If clause where I open an order I print my variable.
However I find 3 times more print than orders. Looking deeper, it seems that intrabar order generation triggers several execution but only once is executed.
If I deactivate intrabar order generation, I get same number of print than the number of orders.
So, is tere a way to print an output only once for any order when intrabarorder generation is activated?
Precision: In IOG config, allowing only once or several orders per bar does not make any difference on this problem.
Many thanks for your help.
IntrabarOrderGeneration and buy/sell event
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: IntrabarOrderGeneration and buy/sell event
Hi,
It's everything to do with your script. Which orders are you sending? Price orders? They can be modified, cancelled and replaces. Generation of an order and print to an output are guaranteed, but it's execution on the next tick isn't.
Is your question - how do I print only those that executed?
It's everything to do with your script. Which orders are you sending? Price orders? They can be modified, cancelled and replaces. Generation of an order and print to an output are guaranteed, but it's execution on the next tick isn't.
Is your question - how do I print only those that executed?
Re: IntrabarOrderGeneration and buy/sell event
Hi,
yes exactly. I would like to print only once my indicator value when the order is executed. Apparently the code calling the order is done several time a bar but execution is done only once the bar is closed. That would explained the multiple print.
Would you have a solution to print only once?
Thanks.
yes exactly. I would like to print only once my indicator value when the order is executed. Apparently the code calling the order is done several time a bar but execution is done only once the bar is closed. That would explained the multiple print.
Would you have a solution to print only once?
Thanks.
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: IntrabarOrderGeneration and buy/sell event
You can print once the marketposition changes. You can print entryprice or exitprice depending on the order. If the MP changed, that means the order just got filled
Re: IntrabarOrderGeneration and buy/sell event
I already tried that of course but surely not on the good way.
I am a professional developer so I am a bit lost sometimes with EL way of doing things.
To detect a market position change what would be the more logical MC way to do it?
Store previous position in a interabarpersisted variable and compare now position with previous?
I am a professional developer so I am a bit lost sometimes with EL way of doing things.
To detect a market position change what would be the more logical MC way to do it?
Store previous position in a interabarpersisted variable and compare now position with previous?
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: IntrabarOrderGeneration and buy/sell event
I would assume check marketposition on the current bar and if it doesn't match MP on the last bar then there was a change. I'm not an EL programmer, but I think that's how it's done. You add the check into a condition, and if it changed, then print.
Re: IntrabarOrderGeneration and buy/sell event
MarketPosition[1] reports previous position or position of the previous bar?
Thanks
Thanks
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: IntrabarOrderGeneration and buy/sell event
Code: Select all
var: mp(0);
mp = MarketPosition;
mp[1] //market position for the last bar
- Stan Bokov
- Posts: 963
- Joined: 18 Dec 2009
- Has thanked: 367 times
- Been thanked: 302 times
Re: IntrabarOrderGeneration and buy/sell event
Unfortunately, issue is still here...
in my last line of code, after order command I put:
With Intrabar Order Generation activated, logs give me:
-1.00 -1.00
-1.00 -1.00
1.00 1.00
1.00 1.00
1.00 1.00
How can this be possible?
It is multi timeframe, I precise.
Thanks
in my last line of code, after order command I put:
Code: Select all
messagelog(marketposition,marketposition[1] );
-1.00 -1.00
-1.00 -1.00
1.00 1.00
1.00 1.00
1.00 1.00
How can this be possible?
It is multi timeframe, I precise.
Thanks
- TJ
- Posts: 7746
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2225 times
Re: IntrabarOrderGeneration and buy/sell event
Please read Stan's example (post #8) carefully.Unfortunately, issue is still here...
in my last line of code, after order command I put:
With Intrabar Order Generation activated, logs give me:Code: Select all
messagelog(marketposition,marketposition[1] );
-1.00 -1.00
-1.00 -1.00
1.00 1.00
1.00 1.00
1.00 1.00
How can this be possible?
It is multi timeframe, I precise.
Thanks
the square bracket [1] is a bar reference.
the proper syntax for marketposition is the regular bracket
marketposition(1)
Re: IntrabarOrderGeneration and buy/sell event
It is what I want. Position from previous bar. Cf explanations above
Re: IntrabarOrderGeneration and buy/sell event
Does someone from MC can explain this? Or should I raise it as a bug.