SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Dec 15, 2019 1:33 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Feb 20, 2008 4:31 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
Hi,
we've tested our strategy intensively in paper mode and everything seemed to work pretty smooth and as intended.
But when we started live trading today (using IB interface), we had to face some strange behaviour. One of the problems that occured right now, was that the EventHandler method "OnPositionOpened()" was called twice. In this void we set our stop. We traded 1 future contract and it was only one position opened (but obviously with two identical stops attached). So when the stop level was reached BOTH stops executed OnStopExecuted and we ended up having our position reversed, thus we switched from 1 long postion to 1 short position (and not to flat - as intended). OQ sold our (1) position twice. Glad we sat in front of our monitors watching over it, otherwise we could have been pretty poor by now :-/ Again, this Behavior never occured in simulation or backtests.
Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 4:50 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Again, do you know any way (sequence of actions) to reproduce this problem? Does it work well in the papertrading mode with IB?

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 5:36 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
Quote:
Does it work well in the papertrading mode with IB?


Yes it worked perfectly in IB Paper Trading Mode.

We also dont know why the OnPositionOpened() was triggered 2 times and we also don't know how to reproduce this - except for running the strategy again and waiting again for this to happen.

Do you have any suggestions what we could do to to debug this, if this happens again?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 6:13 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
It just happened again, and we still have no idea why.

The Buy Order is sent to IB, IB buys 1 contract, it is shown in the TWS.

But the Event OnPositionOpened() was triggered twice, we write the Stop loss Price in the Output. This is the Routine, sl (double) and stp (Stop) are global:

Code:
   public override void OnPositionOpened ()
   {   
      if(!(stp==null)){stp.Cancel();}      
      stp = SetStop (sl, StopType.Trailing, OpenQuant.API.StopMode.Absolute);
      stp.TraceOnBar = false;
      stp.TraceOnTrade = true;
      stp.TraceOnQuote = false;
      Console.WriteLine("Stop set at: " + stp.StopPrice);
      
   }


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 6:40 pm 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,

Could you please tell how many orders do you see in the OrderManager, how many and what are the execution reports for the orders? What are the transactions in the Portfolio? How many strategies do you run and what instruments do they use?

Regards,
Sergey.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 7:07 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
Hi Sergey,

- We only ever run 1 Strategy at a time
- The Instrument is the DAX Future March 2008
- I now switched to Paper Mode, thats why the Portfolio was cleared
- But in the Order Manager I found these respective Trades

- Normal Long Entry
- Then plz look at the 2 Sell Orders at the same Time 15:56:59
- Then I closed the short Position at 15:57:42 (cannot post more than 3 pics but this execution details are not so important)

The 2 most recent trades in the Order Manager already happened in Paper Trading Mode and are not relevant for this issue.

Here are the screenies:


Attachments:
File comment: OM3
OM3.JPG
OM3.JPG [ 187.15 KiB | Viewed 10626 times ]
File comment: OM2
OM2.JPG
OM2.JPG [ 187.48 KiB | Viewed 10626 times ]
File comment: OM1
OM1.JPG
OM1.JPG [ 164.97 KiB | Viewed 10626 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 9:14 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
By the way, which OQ version do you use?

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 9:32 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
The version is the one from the donwload link on your homepage: 1.0.55

Now in Paper Trading Mode, every time the stop is triggered, we get this error message:

System.NullReferenceException: Object reference not set to an instance of an object.
at MyStrategy.OnStopExecuted(Stop stop) in c:\OpenQuant\Projects\niki_version\code.cs:line 241
at OpenQuant.Trading.StrategyRunner.stop_StatusChanged(StopEventArgs args)

it refers to the line
Code:
atc -= Position.GetPnL();


and its because the Position Object is null - but it can't be null because between triggering OnStopExecuted and the line 241 we do not have the code for selling, its later in line 256 ("ClosePosition()").

and after klicking on Abort, this (already posted) error showed up:


Attachments:
Clockerror.JPG
Clockerror.JPG [ 38.53 KiB | Viewed 10611 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 2:38 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Unfortunately we can not reproduce it in 1.0.55 . Could you try to install the latest OQ ( 2.x ) ?

We are looking into your issues...

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 3:31 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
We now have installed the beta version.

Maybe this information could help: I remember that all of this strange behavoiur began 2 days ago when a strategy running in Paper Trading Mode executed a stop but never closed the Position.

In the chart you could clearly see the green Stop Loss Line and the price going through this line without the typical "Sell" text. The position was closed in the end of Day procedure.

I can remember that we did not restart OpenQuant and later all these problems occured. Could it be that this "not-selling although SL was triggered" was the inital reason? Some sort of global mis-match with the communication to IB?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 6:47 pm 
Offline

Joined: Fri May 25, 2007 1:57 am
Posts: 24
While unlikely, an alternative path of investigation (for the OQ team) is to check if this is caused by the lower level IB API messaging. You would see this exact behaviour if OQ invokes OnPositionOpened when it receives the order filled message from IB without duplication checking (as IB sends this message two or three times).

In addition to regular order status messages, the IB TWS API sends two (or maybe three, can't remember now) "filled" order status messages (at least it used to last time I debugged my API logs a few months ago).

The OQ team may want to check the TWSAPI thread regarding this problem at http://finance.groups.yahoo.com/group/T ... sage/10502


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 21, 2008 7:02 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
Well, it has nothing to do with IB interface since PositionOpened event is called from Portfolio when a new position is created. The only possibility to trigger OnPositionOpened twice is to subscribe to PositionOpened events twice but we don't see it in the code and we still can not reproduce this problem.

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 4:40 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
We have news :-)

It seems that this error occurs because of the delay of the order-filled confirmations. We now ran a strategy without setting a stop loss but using other conditions to exit the position. The schema looks like:


Code:
public override void OnTrade(Trade trade)
   {
      if(HasPosition)
      {
         if(Position.Side == PositionSide.Short)
         {
            if(/*exit condition  goes here*/)
            {
               Console.WriteLine(";" + Position.GetPnL());
               ClosePosition();
            }
         }
         else
         {
            if(*exit condition  goes here*/)
            {
               Console.WriteLine(";" + Position.GetPnL());
               ClosePosition();
            }
         }
      }
   }


-> and it seems like the ClosePosition() procedure does not wait for the confirmation from IB that the order is really executed, because the next time OnTrade() is triggered, HasPositions is still true. And thats why OQ tries to sell (in case of long position) again.

We don't know if it is exactly the same problem we described in the postings above. But the behaviour is quite similar.

We also wrote out the error messages in the Output, here are the results:

Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
;-187,5
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
;-200
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
;25
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.
Order Event Warning:Attribute 'Outside Regular Trading Hours' is ignored based on the order type and destination. PlaceOrder is now being processed.
WARNING! Callback 'OPEN_ORDER' was not processed.
Order rejected - reason:YOUR ORDER IS NOT ACCEPTED.
IN ORDER TO OBTAIN THE DESIRED POSITION YOUR
NET LIQ IN EUR DENOMINATED ASSETS [xxx] MUST EXCEED
THE MARGIN REQ [20250] FOR THOSE ASSETS
WARNING! Callback 'OPEN_ORDER' was not processed.


--> As you can see, if we had enought money the program could have bought dozens of contracts :-).

So the question is: How can we be sure that OnTrade() is blocked until ClosePosition() recieves the trade confirmation and HasPosition turns to false?

We think, the behaviour is only possible in live mode because there you have the real delay a normal trade can have. And as already mentioned, this behaviour never occured in Paper Trading Mode.

Looking forward to your reply

H.M. :shock:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 4:58 pm 
Offline

Joined: Thu Jan 31, 2008 11:39 am
Posts: 166
After thinking again about the problem, we came to the conclusion that it is the exacytl same reason as with the Stop Loss Problem!

We use 1 Second bars. There we check if the condition HasPosition() is true or not. If not we buy. The Buying process takes too long, and in the next 1 second bar, HasPosition is still false, and therefore the OpenPosition and in consequence the OnPositionOpened() procedure is called again. Fortunately :lol: , our account does not have the value for another contract, so the 2nd Order fails, but the Stop Loss is still generated!

We are now thinking about using Order Object and checking the State of the Order in addition. We hope this will solve the problem. Do you agree with this?

Thanks in advance for your help, we really appreciate a clear answer since we've already lost about realized 75€ and about 500€ of possible gains due to this behaviour.

Regards,

H.M. :shock:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 22, 2008 4:59 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
So this is not OQ bug? Why don't you use a flag like canEntry / canExit that you set when you send an order, clear in OnOrderFilled and then check in OnTrade to not enter/exit several times?

Regards,
Anton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group