Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 25
 6 Attachment(s)    

Thread: Dynamic Trading System ( DTS)

  1. #11
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default

    Quote Originally Posted by funyoo View Post
    You have made a good job, this system is nice.

    Here is the code. Unfortunately, it is not complete. All the exit conditions generate conflicts. I have spent hours on it and I have not found why. The orders will close only when an opposite signal will appear. As the conditions are heavy, you should contact a professionnal programmer.

    The Heiken_Ashi_Smoothed_Alert_Lines replaces the Heken Ashi indicator.
    Hi,Dear Funyoo,

    Thank you very much for spending your times for coding my system.I will check them and if I need for change condition contact you.

    Thanks alot , again.

    Good Luck!

  2. #12
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default Dynamic Trading System ( DTS) need to repair !!!

    hello dear funyoo,

    thanks a lot for spending your time for coding my system.

    You are very good Programmer.

    I checked and reviewed your EA and I changed it ( Readable)!!

    I have 3 problems that I think you can resolve them.

    1: In Possition Initialisation section:
    when : if(OP>=1){OS=0; OB=0;}OB=0;OS=0;CB=0;CS=0; ( default ) any position is opened !!!!
    But when I change it to : if(OP>=1){OS=0; OB=0;}OB=1;OS=1;CB=0;CS=0;
    system gets position. why?

    2. All open positions NOT CLOSE anyway !!!!????

    3. Where is Order Line for reverse position?

    Please recheck it and repair if nessesaryAttachment 2168
    Last edited by paradise; 12-17-2008 at 18:24.

  3. #13
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Hi paradise,

    Quote Originally Posted by paradise View Post
    1: In Possition Initialisation section:
    when : if(OP>=1){OS=0; OB=0;}OB=0;OS=0;CB=0;CS=0; ( default ) any position is opened !!!!
    But when I change it to : if(OP>=1){OS=0; OB=0;}OB=1;OS=1;CB=0;CS=0;
    system gets position. why?
    Because OB means Open Buy and OS Open Sell.

    Quote Originally Posted by paradise View Post
    2. All open positions NOT CLOSE anyway !!!!????
    Strange, because the conditions to close are good at lines 485 and 593.

    I suggest you to replace this part (line 471) :

    Code:
    if(MAFIB=="true"  &&  SBUY=="true"  &&  TIFI=="false")
       {if(Reverse)SV=1;else BV=1;break;}
    
    if(MAFIS=="true"  &&  SSEL=="true"  &&  TIFI=="false")
       {if(Reverse)BV=1;else SV=1;break;}}
    By this :

    Code:
    if(MAFIB=="true"  &&  SBUY=="true"  &&  TIFI=="false")
       {if(Reverse){SV=1;CloseAllBuy();}else {BV=1;CloseAllSell();}break;}
    
    if(MAFIS=="true"  &&  SSEL=="true"  &&  TIFI=="false")
       {if(Reverse){BV=1;CloseAllSell();}else {SV=1;CloseAllBuy();}break;}}
    And at line 758 before void, add this :

    Code:
    int CloseAllBuy(){double myAsk;double myBid;int myTkt;double myLot;int myTyp;int i;bool result = false;
    for(i=OrdersTotal();i>=0;i--){OrderSelect(i,SELECT_BY_POS);myAsk=MarketInfo(OrderSymbol(),MODE_ASK);            
    myBid=MarketInfo(OrderSymbol(),MODE_BID);myTkt=OrderTicket();myLot=OrderLots();myTyp=OrderType();
    switch(myTyp){case OP_BUY:result=OrderClose(myTkt,myLot,myBid,Slippage,Red);CEBuy++;break;
    case OP_BUYLIMIT:case OP_BUYSTOP:result=OrderDelete(OrderTicket());}
    if(result == false){Alert("Order",myTkt,"failed to close. Error:",GetLastError());
    Print("Order",myTkt,"failed to close. Error:",GetLastError());Sleep(3000);}Sleep(1000);CEProc++;}}
    
    int CloseAllSell(){double myAsk;double myBid;int myTkt;double myLot;int myTyp;int i;bool result = false;
    for(i=OrdersTotal();i>=0;i--){OrderSelect(i,SELECT_BY_POS);myAsk=MarketInfo(OrderSymbol(),MODE_ASK);            
    myBid=MarketInfo(OrderSymbol(),MODE_BID);myTkt=OrderTicket();myLot=OrderLots();myTyp=OrderType();
    switch(myTyp){case OP_SELL:result=OrderClose(myTkt,myLot,myAsk,Slippage,Red);CESell++;break;
    case OP_SELLLIMIT:case OP_SELLSTOP:result=OrderDelete(OrderTicket());}
    if(result == false){Alert("Order",myTkt,"failed to close. Error:",GetLastError());
    Print("Order",myTkt,"failed to close. Error:",GetLastError());Sleep(3000);}Sleep(1000);CEProc++;}}
    Also, this after extern parameters (at the top of the EA) :

    Code:
    double CECount;double CEProc;double CEBuy;double CESell;
    If it doesn't work, I suggest you to find another function to close the buy/sell orders.

    Quote Originally Posted by paradise View Post
    3. Where is Order Line for reverse position?
    This (line 471) :

    if(MAFIB=="true" && SBUY=="true" && TIFI=="false")
    {if(Reverse)SV=1;else BV=1;break;}

    if(MAFIS=="true" && SSEL=="true" && TIFI=="false")
    {if(Reverse)BV=1;else SV=1;break;}}
    Note that I would have to add this part also in the closing conditions :

    if(Reverse)CS=1;else CB=1;

    if(Reverse)CB=1;else CS=1;

  4. #14
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default

    Hi,FunYoo,

    I entered your code in expert , but don't solved my problem!!
    any positions don't close , yet.!!! but expert has any error.
    when I back test it in strategy tester , I see 2 errors in Journal :
    TDI-MVA ...: unknown subwindow number-1 for ObjectCreate function.
    while I have TDI-MVA in INdicators folder .
    and this Error on EA :
    OrderClose Error 131.
    please Recheck EA V.1 below.
    Please Guide me.
    Thanks a lot.
    Last edited by paradise; 12-21-2008 at 13:24.

  5. #15
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by paradise View Post
    Hi,FunYoo,

    I entered your code in expert , but don't solved my problem!!
    any positions don't close , yet.!!! but expert has any error.
    when I back test it in strategy tester , I see 2 errors in Journal :
    TDI-MVA ...: unknown subwindow number-1 for ObjectCreate function.
    while I have TDI-MVA in INdicators folder .
    and this Error on EA :
    OrderClose Error 131.
    please Recheck EA V.1 below.
    Please Guide me.
    Thanks a lot.
    The "unknown subwindow number-1 for ObjectCreate function" error comes from the indicator. You have to delete this line : WindowFind("TDI-MVA") in the Createline function.

    For the other error, closing and 131, try to replace the int CloseAllBuy() by this one :

    Code:
    int CloseAllBuy(){
      int total = OrdersTotal();
      for(int i=total-1;i>=0;i--)
      {
        OrderSelect(i, SELECT_BY_POS);
        int type   = OrderType();
    
        bool result = false;
        
        switch(type)
        {
          //Close opened long positions
          case OP_BUY       : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
                              break;
    
          //Close pending orders
          case OP_BUYLIMIT  :
          case OP_BUYSTOP   : result = OrderDelete( OrderTicket() );
        }
        
        if(result == false)
        {
          Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
          Sleep(3000);
        }  
      }
    }
    And the int CloseAllSell() by this one :

    Code:
    int CloseAllBuy(){
    
      int total = OrdersTotal();
      for(int i=total-1;i>=0;i--)
      {
        OrderSelect(i, SELECT_BY_POS);
        int type   = OrderType();
    
        bool result = false;
        
        switch(type)
        {    
          //Close opened short positions
          case OP_SELL      : result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
                              break;
    
          //Close pending orders
          case OP_SELLLIMIT :
          case OP_SELLSTOP  : result = OrderDelete( OrderTicket() );
        }
        
        if(result == false)
        {
          Alert("Order " , OrderTicket() , " failed to close. Error:" , GetLastError() );
          Sleep(3000);
        }  
      }
    }

  6. #16
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default

    Hi funyoo,

    I changed this line in TDI-MVA Indi :
    ObjectCreate(objName, OBJ_TREND,WindowFind("TDI-MVA"),0, start, Time[0], end);
    to:
    ObjectCreate(objName, OBJ_TREND,0, start, Time[0], end);

    AND :
    those codes for CloseAllBuy and CloseAllSell :

    But NOTHING CHANGE !!!!!!!
    2 errors are in Journal and all position NOT Close.

    Please recheck.

    Thanks
    Last edited by paradise; 12-21-2008 at 15:33.

  7. #17
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    I suggest you to contact a professional coder that will have more time to consacrate to you.

  8. #18
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default

    Quote Originally Posted by funyoo View Post
    I suggest you to contact a professional coder that will have more time to consacrate to you.
    Dear FunYoo,

    Thank You Very Much For Spending Your time to this system and very sorry that you don't want to Complete it!

    I hope you success in all your targets.
    GOOD LUCK !

    Paradise.

  9. #19
    Junior Member
    Join Date
    Dec 2008
    Posts
    10

    Default

    Hi, FunYoo,
    I see that you use this code for many your EA :

    //positions initialization
    int cnt=0,OP=0,OS=0,OB=0,CS=0,CB=0;OP=0;for(cnt=0;cnt< OrdersTotal();cnt++){OrderSelect(cnt,SELECT_BY_POS ,MODE_TRADES);
    if((OrderType()==OP_SELL||OrderType()==OP_BUY)&&Or derSymbol()==Symbol()&&((OrderMagicNumber()==Magic )||Magic==0))OP=OP+1;}
    if(OP>=1){OS=0; OB=0;}OB=0;OS=0;CB=0;CS=0;int SL=StopLoss;int TP=TakeProfit;

    I think that OB=0;OS=0 ( RED ) must be OB=1;OS=1;Don't them?

  10. #20
    Administrator funyoo's Avatar
    Join Date
    Sep 2008
    Posts
    7,003

    Default

    Quote Originally Posted by paradise View Post
    //positions initialization
    int cnt=0,OP=0,OS=0,OB=0,CS=0,CB=0;OP=0;for(cnt=0;cnt< OrdersTotal();cnt++){OrderSelect(cnt,SELECT_BY_POS ,MODE_TRADES);
    if((OrderType()==OP_SELL||OrderType()==OP_BUY)&&Or derSymbol()==Symbol()&&((OrderMagicNumber()==Magic )||Magic==0))OP=OP+1;}
    if(OP>=1){OS=0; OB=0;}OB=0;OS=0;CB=0;CS=0;int SL=StopLoss;int TP=TakeProfit;

    I think that OB=0;OS=0 ( RED ) must be OB=1;OS=1;Don't them?
    No, at this moment we initialize these parameters. Then we give them a value if the conditions are fullfilled :

    Code:
    if(SV>0){OS=1;OB=0;}if(BV>0){OB=1;OS=0;}
    I suggest you to do your own code if you want something clear.

Similar Threads

  1. 3C+ Trading system
    By Vadim_m in forum Commercial manual systems
    Replies: 3
    Last Post: 02-18-2014, 05:33
  2. PipsFlush System F (Manual Trading System)
    By rstr in forum Commercial manual systems
    Replies: 1
    Last Post: 08-13-2009, 15:18
  3. Learn System Poacher Trading System
    By mehdisalehi in forum Technical analysis
    Replies: 2
    Last Post: 05-21-2009, 03:27
  4. Dynamic Trading System EA
    By funyoo in forum Expert advisors backtesting
    Replies: 0
    Last Post: 12-12-2008, 21:51
  5. EOD Trading System EA
    By funyoo in forum Expert advisors live statements
    Replies: 0
    Last Post: 11-13-2008, 16:11

Tags for this Thread

100, backtesting, change, closing, coding, color, eas, expert, funyoo, guide, high, indicator, indicators, programmer, sells, signal, slippage, stoploss, strategy, system, test, time, tool, trading, trading system, trend

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •