What's wrong with the stoploss?
  #1 (permalink)  
Old 09-24-2005, 03:49 AM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default What's wrong with the stoploss?

Hi everyone,

this is a simple expert that actually came with the InterbankFX trader I believe. I noticed the stop loss is WAY off here.

http://www.forex1000.com/FXFisherman/bullbear.mql

If the stop loss is set at 30 then it will befor example a stop loss of 30.2227 instead of 1.2227 So above is the code in the mql format, can anyone figure out whats wrong with it?

Thanks
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #2 (permalink)  
Old 09-24-2005, 07:53 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,930
Thanks: 99
Thanked 365 Times in 149 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Real stoploss must be in point. So, replace StopLoss with StopLoss*Point
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #3 (permalink)  
Old 09-24-2005, 05:58 PM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

now instead of showing 30.2227 it shows 31.2227

Maybe its not coded right somewhere else?
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #4 (permalink)  
Old 09-25-2005, 12:52 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,930
Thanks: 99
Thanked 365 Times in 149 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Maybe this is a backtester's bug, you know it. If you compiled it already, then it should work just fine live.

Just to confirm if you replaced it right. Compare the following code with yours:

Code:
SetOrder(OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,RED)
Code:
SetOrder(OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,RED)
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 09-25-2005 at 12:57 AM.
Reply With Quote
  #5 (permalink)  
Old 09-25-2005, 08:05 PM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

Yep thats exactly what I have minus the space between the Bid and -Takeproft*Point

Ill check this afternoon if its only backtesting or not, but before it was both backtesting AND demo trading that had the problem, hopefully it will resolve it
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #6 (permalink)  
Old 09-26-2005, 01:25 AM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

Nope its a problem with live trading as well. It's won 4 consective trades of 10 and 11 pips but stop losses are still at 31.xxxx also I noticed in the backtest its only making short trades, on the live testing all 4 were short as well but that might just be the trend.

Also noticed that it hits 10 and 11 pips profit (spread already passed) and then closes the trade. But the trailing stop is set at 10 and take profit at 30..

This doesnt make much sense..
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #7 (permalink)  
Old 09-26-2005, 02:25 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,930
Thanks: 99
Thanked 365 Times in 149 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

It works just fine on my computer. Test below code.

Code:
/*[[ Name := bullbear Author := Copyright © 2003, Company Link := http://www.company.com/ Lots := 1.00 Stop Loss := 30 Take Profit := 40 Trailing Stop := 5 ]]*/ //previous position var: pos1pre(0); //current position var: pos2cur(0); var: cnt(0); comment(Bid+(StopLoss*Point)); pos1pre = iBullsPower(13,PRICE_WEIGHTED,1); pos2cur = iBullsPower(13,PRICE_WEIGHTED,0); if pos1pre >pos2cur then { //close long position for cnt=1 to TotalTrades { If OrderValue(cnt,VAL_TYPE)=OP_BUY then // buy position open { if Bid>(OrderValue(cnt,VAL_OPENPRICE)+TrailingStop*Point) then { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Bid,3,Violet); // close long Exit; }; }; }; }; if pos2cur<0 then //close short position { for cnt=1 to TotalTrades { if Ask<(OrderValue(cnt,VAL_OPENPRICE)-TrailingStop*Point) then { If OrderValue(cnt,VAL_TYPE)=OP_SELL then // sell position open { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_LOTS),Ask,3,Violet); // close short Exit; }; }; }; }; If TotalTrades<1 then { //no current orders. Check for possible short conditions. print("pos1pre = "+pos1pre+" pos2cur ="+pos2cur); if pos1pre>pos2cur and pos2cur>0 then { SetOrder(OP_SELL,Lots,Bid,3,Bid+(StopLoss*Point),Bid-(TakeProfit*Point),RED); // open short Exit; }; //check for long conditions. If pos2cur<0 then { SetOrder(OP_BUY,Lots,Ask,3,Ask-(StopLoss*Point),Ask+(TakeProfit*Point),RED); // open long Exit; }; };
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's wrong with this moving average alert? forextrend Indicators 3 03-28-2006 03:53 AM
How to know when a stoploss was hit. TraderSeven MetaTrader and ZeroCode 0 07-30-2005 11:03 AM


All times are GMT. The time now is 05:06 AM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now