Dukascopy
 
 
Wiki JStore Search Login

Trailing stop of parabolic sar dosen't work in this strategy
 Post subject: Trailing stop of parabolic sar dosen't work in this strategy Post rating: 0   Post Posted: Sat 18 Jan, 2014, 22:01 

User rating: 0
Joined: Sat 11 Jan, 2014, 01:42
Posts: 2
hello all
i have this strategy work very will in the MT4 platforms but when i Converted it to JForex opening market orders is good but moving stop loss with parabolic sar doesn't work if anyone can help me with this issue it' appreciated and i will attached all its 2 file mt4 and the Converted file i hope to hear good respond from your side.
all the best


Attachments:
j214.jfx [7.68 KiB]
Downloaded 68 times
214.mq4 [5.09 KiB]
Downloaded 72 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Trailing stop of parabolic sar dosen't work in this strategy Post rating: 0   Post Posted: Mon 20 Jan, 2014, 17:08 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This strategy should work fine in next API release. The release is scheduled this week.

If you don't want to wait, then you can modify your strategy a little by applying function NormalizeDouble to your stoploss values in Modify_SL_BY_Open() and it should fix the problem as well. Here is how Modify_SL_BY_Open() should look in this case:

void Modify_SL_BY_Open()
{
  for(int i=0;i<OrdersTotal();i++)
  {
    OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
    double StopLoss=OrderStopLoss();int ticket=OrderTicket();
    double sar1= iSAR(0,0,0.02,0.2,0);
    if(OrderSymbol()==Symbol()&&OrderMagicNumber()==MagicNumber)
    {
      if(OrderType()==OP_BUY)
      {
        if(StopLoss!=sar1&&Bid>sar1)
        {
          OrderModify(ticket,OrderOpenPrice(),NormalizeDouble(sar1, Digits),OrderTakeProfit(),0);
        }
      }
      if(OrderType()==OP_SELL)
      {
        if(StopLoss!=sar1&&Ask<sar1)
        {
          double stoploss = sar1+MarketInfo(Symbol(),MODE_SPREAD)*Point;
          OrderModify(ticket,OrderOpenPrice(), NormalizeDouble(stoploss, Digits),OrderTakeProfit(),0);
        }
      }
    }
  }



 
 Post subject: Re: Trailing stop of parabolic sar dosen't work in this strategy Post rating: 0   Post Posted: Mon 20 Jan, 2014, 21:28 

User rating: 0
Joined: Sat 11 Jan, 2014, 01:42
Posts: 2
Dear API Support
Many thank' for your help now it work good and i appreciated your assistant and fast help and i wish you all the best :roll:


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com