SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sat Jul 20, 2019 5:14 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: a simple system
PostPosted: Mon Jun 14, 2010 5:24 pm 
Offline

Joined: Mon Aug 24, 2009 4:28 pm
Posts: 43
how to program the following simple system:


if now price is higher than buy price, then exist at buy price +3 ticksize

if now price is lower than buy price, then exist at buy price - 3 ticksize.

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2010 9:06 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
exist?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2010 9:07 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
And when are you going to enter btw?

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2010 3:35 am 
Offline

Joined: Mon Aug 24, 2009 4:28 pm
Posts: 43
Dr. Anton Fokin wrote:
exist?


Sorry , existing price / entry price


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2010 3:37 am 
Offline

Joined: Mon Aug 24, 2009 4:28 pm
Posts: 43
Dr. Anton Fokin wrote:
And when are you going to enter btw?

Regards,
Anton


enter: last bar high + 1 ticksize


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 15, 2010 8:56 am 
Offline

Joined: Sat Jun 07, 2008 1:41 pm
Posts: 47
Location: Munich, Germany
There are thousands of possibilities. Here is a piece to point into one direction. This is just to study.

Code:
         // define Order limitOrder
         // define NmbOfTicks, e.g. Forex 0.0003, FESX 3, or whatever
         // define EntryBuyPrice
         
         // browse in this forum to find how to do it.
      
         if (HasPosition  &&  Position.Side == PositionSide.Long  &&  DoOnlyOnce == 0)
         {         
               DoOnlyOnce = 1;
               limitOrder = LimitOrder(OrderSide.Sell, Position.Qty, EntryBuyPrice + NmbOfTicks);
               limitOrder.Send();
         }
         if (!HasPosition)
         {
               DoOnlyOnce = 0;
         } 


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2010 11:37 am 
Offline

Joined: Mon Aug 24, 2009 4:28 pm
Posts: 43
rdt wrote:
There are thousands of possibilities. Here is a piece to point into one direction. This is just to study.

Code:
         // define Order limitOrder
         // define NmbOfTicks, e.g. Forex 0.0003, FESX 3, or whatever
         // define EntryBuyPrice
         
         // browse in this forum to find how to do it.
      
         if (HasPosition  &&  Position.Side == PositionSide.Long  &&  DoOnlyOnce == 0)
         {         
               DoOnlyOnce = 1;
               limitOrder = LimitOrder(OrderSide.Sell, Position.Qty, EntryBuyPrice + NmbOfTicks);
               limitOrder.Send();
         }
         if (!HasPosition)
         {
               DoOnlyOnce = 0;
         } 


HI, it doesn't work...OQ can't recognize the entrybuyprice


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2010 1:48 pm 
Offline

Joined: Sat Jun 07, 2008 1:41 pm
Posts: 47
Location: Munich, Germany
You need to check some code here in the forum to understand. From there you learn a bit here and a bit there. Otherwise you will not be able to create your own systems.


double EntryBuyPrice;


public override OnBar()
{
if (!HasPosition && Bar.Close > ???)
{
EntryBuyPrice = Bar.Close;

//here now comes your order to enter the market

}

//here comes your limit-exit and your stop loss order

}


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 17, 2010 4:22 pm 
Offline

Joined: Mon Aug 24, 2009 4:28 pm
Posts: 43
rdt wrote:
You need to check some code here in the forum to understand. From there you learn a bit here and a bit there. Otherwise you will not be able to create your own systems.


double EntryBuyPrice;


public override OnBar()
{
if (!HasPosition && Bar.Close > ???)
{
EntryBuyPrice = Bar.Close;

//here now comes your order to enter the market

}

//here comes your limit-exit and your stop loss order

}


Thank you....indeed


Top
 Profile  
 
 Post subject: Re: a simple system
PostPosted: Wed Apr 17, 2019 10:08 am 
Offline

Joined: Wed Jan 09, 2019 2:37 pm
Posts: 1
qichxi wrote:
how to program the following simple system:


if now price is higher than buy price, then exist at buy price +3 ticksize

if now price is lower than buy price, then exist at buy price - 3 ticksize.

thank you


exist?


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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:  
cron
Powered by phpBB® Forum Software © phpBB Group