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

RoundNumberTrap
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=279
Page 5 of 6
Author:  viracoccha [ Thu Jan 26, 2012 3:57 pm ]
Post subject:  Re: RoundNumberTrap

holy moly .......sorry to spam here but it made 0.01 SELL order in 1.31400 and 0.02 BUY is pending 1.32100 .... no logic
Author:  gaheitman [ Thu Jan 26, 2012 8:40 pm ]
Post subject:  Re: RoundNumberTrap

viracoccha wrote:holy moly .......sorry to spam here but it made 0.01 SELL order in 1.31400 and 0.02 BUY is pending 1.32100 .... no logic
Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?

George
Author:  viracoccha [ Fri Jan 27, 2012 8:17 am ]
Post subject:  Re: RoundNumberTrap

gaheitman wrote:
viracoccha wrote:holy moly .......sorry to spam here but it made 0.01 SELL order in 1.31400 and 0.02 BUY is pending 1.32100 .... no logic
Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?

George
Yes ... half number was true ... it made SELL order 1.31400 and placed pending BUY 70 pips higher in 1.32100.... at the moment there is no failures .... if I notice that anomaly again then I make a screen shot. Yesterday I noticed that error twice. Lets see how long I can follow my acc today.
Author:  gaheitman [ Fri Jan 27, 2012 8:41 am ]
Post subject:  Re: RoundNumberTrap

viracoccha wrote:
gaheitman wrote:
viracoccha wrote:holy moly .......sorry to spam here but it made 0.01 SELL order in 1.31400 and 0.02 BUY is pending 1.32100 .... no logic
Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?

George
Yes ... half number was true ... it made SELL order 1.31400 and placed pending BUY 70 pips higher in 1.32100.... at the moment there is no failures .... if I notice that anomaly again then I make a screen shot. Yesterday I noticed that error twice. Lets see how long I can follow my acc today.
Mike,

I think the issue is in start()

Code: Select all

   if (PendingTrades==0 && OpenTrades==0 && (Ask==RoundNumberHigh || (TradeHalfNumbers && Ask==HalfRoundNumberHigh)|| (TradeBigNumbers && Ask==BigNumberHigh)) )
   {
      //Big number filter
      if (RoundNumberHigh == BigNumberHigh && !TradeBigNumbers) return;
      
      res=OpenTrades(Ask, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberHigh;
   }
   if (PendingTrades==0 && OpenTrades==0 &&  (Bid==RoundNumberLow || (TradeHalfNumbers && Bid==HalfRoundNumberLow)|| (TradeBigNumbers && Bid==BigNumberLow)) )
   {
      //Big number filter
      if (RoundNumberLow == BigNumberLow && !TradeBigNumbers) return;
      
      res=OpenTrades(Bid, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberLow;
   }   
Shouldn't you be setting RoundNumber equal to HalfRoundNumberHigh/Low when that is the price that was hit? You use RoundNumber in MonitorOCO() to calculate the next pending order, which is why it's popping up over the NextRoundNumberHigh instead of the HalfRoundNumber.

George
Author:  magft [ Fri Jan 27, 2012 9:17 am ]
Post subject:  Re: RoundNumberTrap

gaheitman wrote:
Mike,

I think the issue is in start()

Code: Select all

   if (PendingTrades==0 && OpenTrades==0 && (Ask==RoundNumberHigh || (TradeHalfNumbers && Ask==HalfRoundNumberHigh)|| (TradeBigNumbers && Ask==BigNumberHigh)) )
   {
      //Big number filter
      if (RoundNumberHigh == BigNumberHigh && !TradeBigNumbers) return;
      
      res=OpenTrades(Ask, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberHigh;
   }
   if (PendingTrades==0 && OpenTrades==0 &&  (Bid==RoundNumberLow || (TradeHalfNumbers && Bid==HalfRoundNumberLow)|| (TradeBigNumbers && Bid==BigNumberLow)) )
   {
      //Big number filter
      if (RoundNumberLow == BigNumberLow && !TradeBigNumbers) return;
      
      res=OpenTrades(Bid, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberLow;
   }   
Shouldn't you be setting RoundNumber equal to HalfRoundNumberHigh/Low when that is the price that was hit? You use RoundNumber in MonitorOCO() to calculate the next pending order, which is why it's popping up over the NextRoundNumberHigh instead of the HalfRoundNumber.

George
George, do you mean like this:

Code: Select all

   if (PendingTrades==0 && OpenTrades==0 && (Ask==RoundNumberHigh || (TradeHalfNumbers && Ask==HalfRoundNumberHigh)|| (TradeBigNumbers && Ask==BigNumberHigh)) )
   {
      //Big number filter
      if (RoundNumberHigh == BigNumberHigh && !TradeBigNumbers) return;
      
      res=OpenTrades(Ask, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberHigh;

      if (TradeHalfNumbers && Ask==HalfRoundNumberHigh) RoundNumber = HalfRoundNumberHigh;
   }
   if (PendingTrades==0 && OpenTrades==0 &&  (Bid==RoundNumberLow || (TradeHalfNumbers && Bid==HalfRoundNumberLow)|| (TradeBigNumbers && Bid==BigNumberLow)) )
   {
      //Big number filter
      if (RoundNumberLow == BigNumberLow && !TradeBigNumbers) return;
      
      res=OpenTrades(Bid, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberLow;

      if (TradeHalfNumbers && Bid==HalfRoundNumberLow) RoundNumber=HalfRoundNumberLow;

   }   
Regards

Mike
Author:  gaheitman [ Fri Jan 27, 2012 9:54 am ]
Post subject:  Re: RoundNumberTrap

magft wrote:George, do you mean like this:

Code: Select all

   if (PendingTrades==0 && OpenTrades==0 && (Ask==RoundNumberHigh || (TradeHalfNumbers && Ask==HalfRoundNumberHigh)|| (TradeBigNumbers && Ask==BigNumberHigh)) )
   {
      //Big number filter
      if (RoundNumberHigh == BigNumberHigh && !TradeBigNumbers) return;
      
      res=OpenTrades(Ask, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberHigh;

      if (TradeHalfNumbers && Ask==HalfRoundNumberHigh) RoundNumber = HalfRoundNumberHigh;
   }
   if (PendingTrades==0 && OpenTrades==0 &&  (Bid==RoundNumberLow || (TradeHalfNumbers && Bid==HalfRoundNumberLow)|| (TradeBigNumbers && Bid==BigNumberLow)) )
   {
      //Big number filter
      if (RoundNumberLow == BigNumberLow && !TradeBigNumbers) return;
      
      res=OpenTrades(Bid, Lot);
      if (res<1) return;
      RoundNumber=RoundNumberLow;

      if (TradeHalfNumbers && Bid==HalfRoundNumberLow) RoundNumber=HalfRoundNumberLow;

   }   
Regards

Mike

Yep. Or maybe something clever that adds 10 pips to bid or ask and then subtracts the mod to the nearest 50 pips (Bid+10*Point*multiplier - MathMod(Bid+10*Point*multiplier,50*Point*multiplier)). Hmm, that may fail the readability test.... :lol:

My other concern with this code is the equivalence test to see if you hit one of the 50/100/1000 lines. On a 5 pip broker, you won't necessarily see the round numbers get hit. Wouldn't using a function like this be better:

Code: Select all

//return true if two prices are within 3 pips of each other
bool CloseToButMaybeNotQuiteEqual( double p1, double p2) {
   return (MathAbs(p1-p2)< 3*Point*multiplier)
}
Or maybe

Code: Select all

//return true if price is between bid/ask spread
bool PriceCross(double p1) {
   return (ask > p1 && bid < p1);
}
Or

Code: Select all

//return true is price was crossed in last two minutes
bool PriceCross(double p1) {
   double high = MathMax(iHigh(Symbol(),PERIOD_M1,0),iHigh(Symbol(),PERIOD_M1,1));
   double low = MathMin(iLow(Symbol(),PERIOD_M1,0),iLow(Symbol(),PERIOD_M1,1));
   
   return(p1 < high && p1 > low);
}
On an unrelated note, it is with mixed emotions that I can report that DFTD() works with the max loss pips setting... :cry:

George
Author:  viracoccha [ Fri Jan 27, 2012 10:25 am ]
Post subject:  Re: RoundNumberTrap

I have one idea .... how we can avoid hovering situation ..... using TP 20, SL 20 and OFF 10 can blow easily .... as my demo this morning .... EURUSD price was around 1.3100 almost 24 hours. So my idea is to use TP 20 and SL 30 BUT in that case we need some ZERO LEVEL what appears when order is in this case 10 pips in proffit. This mean that if BUY lost (-30) then SELL secure his order in ZERO LEVEL, because if BUY losing then SELL is profit with 10 pips.

This helps avoid following situation .... in the picture we can see that I lost 30+30 pips, but if I can use that ZERO level then I would lost only 30 pips.

What you think???


Image
Author:  viracoccha [ Fri Jan 27, 2012 11:11 am ]
Post subject:  Re: RoundNumberTrap

and here is that error ... at least I think so .... it made pending BUY 1.32100, but my logic tells that it should be 1.31600

Image
Author:  Alpenkorps [ Sat Jan 28, 2012 7:36 am ]
Post subject:  Re: RoundNumberTrap

Ok Guys I am back. I had a terrible week defending a GU short position. GU advanced 10 days in a sequence and it didn't happened ever in last decade ... !!!

I am devoting this weekend to finish the archive, Testing this baby properly and losing the rest few dollars in my poker account ... :D
Author:  GT3RS [ Wed Feb 01, 2012 8:48 pm ]
Post subject:  Re: RoundNumberTrap

Hi guys,

I think this strategy has considerable merit, but I would like to add my own suggestion for improvement.

The strategy is based on the concept that there are lots of pending orders/stops built up around the round numbers.

Well, my preference would be for the bot to only trade on the first touch of that particular round number in that session.

Take today for example on EURUSD.

First touch of 1.31000 = successful trade.

First touch of 1.32000 = successful trade.

But it all went horribly wrong when price went back to 1.32000 for a second time.

If we are trading based on orders stacking up around a particular level, then surely, once that level has been touched, many of those orders have been filled and the likelyhood of a successful outcome for us is massively reduced at the second touch.........

So, based on the above, would it be possible to build an option in to the bot so that it only trades on the first round number touch of the London session?

Thanks in advance!
All times are UTC Page 5 of 6