SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Fri Oct 23, 2020 3:10 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed May 18, 2011 10:08 pm 
Offline

Joined: Tue May 10, 2011 2:14 am
Posts: 23
Hi,
Thanks to Anton I almost have a working program. :) But I am having a problem accessing the fill price from my entry.
Code:
   public override void OnPositionOpened()
   {
      if (OCAExitEnabled)
      {
         double profitTarget = entryOrder.AvgPrice+LimitOCA;
         limitOrder = SellLimitOrder(FGBL,Qty, profitTarget, "Limit OCA " + OCACount);
         limitOrder.OCAGroup = "OCA " + Instrument.Symbol + " " + OCACount;               
         limitOrder.Send();

         double lossTarget = entryOrder.AvgPrice+StopOCA;
         stopOrder = SellStopOrder(FGBL,Qty, lossTarget, "Stop OCA " + OCACount);
         stopOrder.OCAGroup = "OCA " + Instrument.Symbol + " " + OCACount;               
         stopOrder.Send();
         OCACount++;
      }
   }


It doesn't like entryOrder.AvgPrice It's almost like it can't access that variable or is not declared for OnPositionOpened. The program gets in on a limit price. It then sets a target and a stop. The Target is 6 ticks (LimitOCA), the stop is 4 ticks (StopOCA). But it cant add/subtract those amounts from entryOrder.AvgPrice. The program compiles fine. but has a strategy error on:
Code:
double profitTarget = entryOrder.AvgPrice+LimitOCA;   


Any suggestions?


Top
 Profile  
 
PostPosted: Fri May 20, 2011 9:54 am 
Offline

Joined: Wed Oct 08, 2003 1:06 pm
Posts: 833
Hi,
Quote:
The program compiles fine. but has a strategy error on:


What kind of error do you see? I guess it is NullReferenceException, if so - please make sure the entryOrder object is initialized before OnPoisitionOpened handler gets called.

Regards,
Sergey.


Top
 Profile  
 
PostPosted: Fri May 20, 2011 6:52 pm 
Offline

Joined: Tue May 10, 2011 2:14 am
Posts: 23
Thank you for your help Sergey. I tried that. But I think I narrowed the problem down to poorly captured historical data (my own fault). If I run it real time it works fine. However it may not be the captured data but a problem with the times dont match up properly on my data. i.e. the products on Eurex I go from 11pm to 1pm but the cme/cbot go from 3:30pm to 2pm


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

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