stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Trail Pending Grid Trades
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4853
Page 1 of 1
Author:  McNish [ Thu Aug 04, 2016 1:34 pm ]
Post subject:  Trail Pending Grid Trades

Hello,
Have been reading up on CJ's Fox trading and following the setups.
The trading style i follow is to find anchor trades first and then follow it up with pyramid trades. While scaling in with pending orders at set price / distance, sometimes (read usually) the price starts to retrace a bit before going in the intended direction. Nothing wrong there as am already set for it.

But then something bugged me to try to better it and take advantage of the price retrace. So i decide to try to code a few lines in order to take advantage of this retrace. And now i am sort of stuck and need a little guidance from the forum coders. This is what i have as a rough skeleton for the logic.

Code: Select all

   void TrailingPendingOrders()
   {
      int Total = OrdersTotal();
      for (int i = Total; i > 0; i--) 
      {
         if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
         string nul = OrderSymbol();
         double spot = MarketInfo(nul,MODE_ASK);
         double OOP = OrderOpenPrice();
         datetime OOT = OrderOpenTime();
         if(OrderType() == OP_BUYSTOP) {
            double spaoot = Symbol()Price@OrderOpenTime();  // how can i find this value ???
            double gap = spaoot - OOP;                      // find price gap of current order
            if(spaoot > (spot + (1/factor)))                // price should retreat altest 1 pip
            {  OrderDelete(OrderTicket(),.......);          // delete current order
               double new_price = spot + gap;               // set new price
               OrderSend(...,new_price,........);           // send new pending order
            } 
         }  
      }   
      return(0);
   }
Am i on the right track?
The only thing i am stuck at, imo, is how to find the tick price of a symbol at certain given time stamp, which in this case reads from the terminal as 2016.08.04 09:35:07.

Please suggest the right way of doing this.

Cheers, Max, :-)
All times are UTC Page 1 of 1