RoundNumberTrap
- viracoccha
- Trader
- Posts: 52
- Joined: Wed Jan 11, 2012 6:34 pm
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
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: RoundNumberTrap
Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?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
George
- viracoccha
- Trader
- Posts: 52
- Joined: Wed Jan 11, 2012 6:34 pm
Re: RoundNumberTrap
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.gaheitman wrote:Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?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
George
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: RoundNumberTrap
Mike,viracoccha wrote: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.gaheitman wrote:Do you have TradeHalfNumbers=true? How about posting a screen shot of the info pane?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
George
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;
}
George
-
magft
- Trader
- Posts: 195
- Joined: Tue Nov 15, 2011 9:59 pm
- Location: East Midlands, UK
Re: RoundNumberTrap
George, do you mean like this:gaheitman wrote:
Mike,
I think the issue is in start()
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.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; }
George
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;
}
Mike
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: RoundNumberTrap
magft wrote:George, do you mean like this:
RegardsCode: 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; }
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....
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)
}
Code: Select all
//return true if price is between bid/ask spread
bool PriceCross(double p1) {
return (ask > p1 && bid < p1);
}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);
}
George
- viracoccha
- Trader
- Posts: 52
- Joined: Wed Jan 11, 2012 6:34 pm
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???

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???

- viracoccha
- Trader
- Posts: 52
- Joined: Wed Jan 11, 2012 6:34 pm
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


- Alpenkorps
- Trader
- Posts: 213
- Joined: Thu Dec 15, 2011 4:03 am
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 ...
I am devoting this weekend to finish the archive, Testing this baby properly and losing the rest few dollars in my poker account ...
Take my love, take my land, Take me where I cannot stand
I don't care, I'm still free, You can't take the sky from me
I don't care, I'm still free, You can't take the sky from me
-
GT3RS
- Trader
- Posts: 198
- Joined: Fri Dec 23, 2011 1:58 pm
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!
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!
You do not have the required permissions to view the files attached to this post.