I have a strategy that sends two breakout buy/sell stop orders, i.e., one long and one short. This is what I see when the orders go in:
In the orders tab I see:
There is an OCO ID for these two orders. Does this mean that MC automatically converted the two buy/sell stops to an OCO order? That would be the intention for this strategy, but just wanted to confirm.
Automatic OCO order?
Re: Automatic OCO order?
The buy-stop just hit its price and entered a position. And the sell-stop was canceled, confirming that this was an OCO order. However, MC put in a new sell-stop position for double the contracts. (Original positions were for 3 contracts)
Rather than *no* sell-stop (because it was canceled), there is now a sell-stop with 6 contracts.
The cancel order: But then there is a new order for double the contracts: The entry code is pretty straightforward:
After one of the stops is hit, does MC reevaluate the strategy code for the bar? Could it be hitting the SellShort statement again, or is there something else going on behind-the-scenes? Either way, I don't understand why the contracts doubled from 3 to 6.
Any idea?
Rather than *no* sell-stop (because it was canceled), there is now a sell-stop with 6 contracts.
The cancel order: But then there is a new order for double the contracts: The entry code is pretty straightforward:
Code: Select all
If SignalDay then
begin
if ( MarketPosition <> 1 ) then
Buy next bar at LBreakoutPrice stop;
if ( MarketPosition <> -1 ) then
Sellshort next bar at SBreakoutPoints stop ;
end;
Any idea?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Automatic OCO order?
. . .
The entry code is pretty straightforward:After one of the stops is hit, does MC reevaluate the strategy code for the bar? Could it be hitting the SellShort statement again, or is there something else going on behind-the-scenes? Either way, I don't understand why the contracts doubled from 3 to 6.Code: Select all
If SignalDay then
begin
if ( MarketPosition <> 1 ) then
Buy next bar at LBreakoutPrice stop;
if ( MarketPosition <> -1 ) then
Sellshort next bar at SBreakoutPoints stop ;
end;
Any idea?
The computer is dumb.
It will do EXACTLY what you tell it to do.
It will continue to do what you tell it to do...
until you tell it not to do anymore, or if you don't tell it to do anything.
Each instruction is good for ONE bar -- the current bar.
The instruction will REPEAT every tick, until the end of the bar.
Re: Automatic OCO order?
Yep, totally agree with you about computers -- GIGO.The computer is dumb.
It will do EXACTLY what you tell it to do.
It will continue to do what you tell it to do...
until you tell it not to do anymore, or if you don't tell it to do anything.
Each instruction is good for ONE bar -- the current bar.
The instruction will REPEAT every tick, until the end of the bar.
But your assessment that the code is repeated with every TICK... that doesn't make sense. If so, then the sellshort line of code would have been repeated 3 x TICKS since the position was opened, which it is obviously not doing. There were be a huge number of sellshort contracts if that were the case.
So, in this case, it's not so much that computers are dumb, but that I (all of us actually) need to have a better understanding of what is going under the hood of MC in order to code the strategy in the way I expect it to behave.
So, again... how is it that, after the OCO order was canceled, that MC generated a new sell-stop order for double the contracts?
That's getting under the hood...
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Automatic OCO order?
Yep, totally agree with you about computers -- GIGO.The computer is dumb.
It will do EXACTLY what you tell it to do.
It will continue to do what you tell it to do...
until you tell it not to do anymore, or if you don't tell it to do anything.
Each instruction is good for ONE bar -- the current bar.
The instruction will REPEAT every tick, until the end of the bar.
But your assessment that the code is repeated with every TICK... that doesn't make sense. If so, then the sellshort line of code would have been repeated 3 x TICKS since the position was opened, which it is obviously not doing. There were be a huge number of sellshort contracts if that were the case.
So, in this case, it's not so much that computers are dumb, but that I (all of us actually) need to have a better understanding of what is going under the hood of MC in order to code the strategy in the way I expect it to behave.
So, again... how is it that, after the OCO order was canceled, that MC generated a new sell-stop order for double the contracts?
That's getting under the hood...
Orders are sent at EOB (End of Bar)
unless you have set IOG (IntrabarOrderGeneration=True)
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Automatic OCO order?
. . .
So, again... how is it that, after the OCO order was canceled, that MC generated a new sell-stop order for double the contracts?
That's getting under the hood...
SELLSHORT is an entry keyword. It will flatten your position before going short.
SELL is used to exit your positions.
Re: Automatic OCO order?
IOG is not enabled. However, the only way I can figure a sell-stop entry being put in by MC for 6 contracts after canceling the OCO order is if it re-evaluated the bar. If it did this, then the 6 contracts makes sense -- the stop is treated as a reversal signal: sell 3 contracts (since I am currently long 3) and then short 3 (to honor the original sell-stop order for 3 contracts).Orders are sent at EOB (End of Bar)
unless you have set IOG (IntrabarOrderGeneration=True)
So did MC re-evaluate the bar after the buy-stop was hit (which I am thinking not since, as you mention, this bar should only be evaluated once at close), or did it perform some underlying logic behind-the-scenes?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Automatic OCO order?
IOG is not enabled. However, the only way I can figure a sell-stop entry being put in by MC for 6 contracts after canceling the OCO order is if it re-evaluated the bar. If it did this, then the 6 contracts makes sense -- the stop is treated as a reversal signal: sell 3 contracts (since I am currently long 3) and then short 3 (to honor the original sell-stop order for 3 contracts).Orders are sent at EOB (End of Bar)
unless you have set IOG (IntrabarOrderGeneration=True)
So did MC re-evaluate the bar after the buy-stop was hit (which I am thinking not since, as you mention, this bar should only be evaluated once at close), or did it perform some underlying logic behind-the-scenes?
Where did I say the bar should only be evaluated once at close?
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Automatic OCO order?
Implied when you said "Orders are sent at EOB (End of Bar)". If that's not what you meant, then misinterpretation.Where did I say the bar should only be evaluated once at close?
Please see my first answer to you in the third post.