SmartQuant Discussion
http://www.smartquant.com/forums/

a simple system
http://www.smartquant.com/forums/viewtopic.php?f=44&t=8081
Page 1 of 1

Author:  qichxi [ Mon Jun 14, 2010 5:24 pm ]
Post subject:  a simple system

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

Author:  Dr. Anton Fokin [ Mon Jun 14, 2010 9:06 pm ]
Post subject: 

exist?

Author:  Dr. Anton Fokin [ Mon Jun 14, 2010 9:07 pm ]
Post subject: 

And when are you going to enter btw?

Regards,
Anton

Author:  qichxi [ Tue Jun 15, 2010 3:35 am ]
Post subject: 

Dr. Anton Fokin wrote:
exist?


Sorry , existing price / entry price

Author:  qichxi [ Tue Jun 15, 2010 3:37 am ]
Post subject: 

Dr. Anton Fokin wrote:
And when are you going to enter btw?

Regards,
Anton


enter: last bar high + 1 ticksize

Author:  rdt [ Tue Jun 15, 2010 8:56 am ]
Post subject: 

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;
         } 

Author:  qichxi [ Thu Jun 17, 2010 11:37 am ]
Post subject: 

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

Author:  rdt [ Thu Jun 17, 2010 1:48 pm ]
Post subject: 

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

}

Author:  qichxi [ Thu Jun 17, 2010 4:22 pm ]
Post subject: 

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

Author:  Blood [ Wed Apr 17, 2019 10:08 am ]
Post subject:  Re: a simple system

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?

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/