Experts: OpenTiks - page 2

 
lastman:

Hii

Beautifull ea.... Thank you..

[url=http://imageshack.us][img=http://img220.imageshack.us/img220/9898/eatikkgu8.jpg][/url]

https://c.mql5.com/3/34/my_phppimageleatikkgu8.jpg

 

Hello zerkmarx,

I've got some error while test your EA.

There are some modify error 1 and close order error 131.

Is anyone have the same error as I am?


Thank you.

 

You know that, whenever quotes aren't recorded on history (menu: tools->history center), tester has to generate prices (and I emphasise the word generate) for the time inside each bar. Try to think about this.

 

?

> I did not get these results at all. Is their something in the set up I am missing?

I think it only works on accounts sub-pip pricing...

FXCM & Alpari UK work well, for MIG this does not work

...

FWIW

-BB-

 

Hi,

I don't understand what this code mean :

             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Ask,3,Green);
               }

My assumption is : It will close the orders if the orders lot is greater than broker minimum lot.

Is that true? If it's true why you should do that?

And what do you mean of

PolLots

int the variable declaration mean?


Thank you.


(sorry for my bad English)

 
radubaies:

this is not but another version of adding up strategy

put random numbers for buying adn selling and you get the same results

//+------------------------------------------------------------------+
//|                                                     OpenTiks.mq4 |
//|                                        Copyright © 2008, ZerkMax |
//|                                                      zma@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, ZerkMax"
#property link      "zma@mail.ru"
extern int    Shift1          = 0;
extern int    Shift2          = 1;
extern int    Shift3          = 2;
extern int    Shift4          = 3;
extern int    TrailingStop   = 30;
extern int    StopLoss       = 0;
extern double Lots           = 0.1;
extern bool RiskManagement=false; //money management
extern double RiskPercent=10; //risk in percentage
extern int    magicnumber    = 777;
extern bool   PolLots        = true;
extern int    MaxOrders      =  1;
int prevtime;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   //risk management
   
   bool MM=RiskManagement;
   if(MM){if(RiskPercent<0.1||RiskPercent>100){Comment("Invalid Risk Value.");return(0);}
   else{Lots=MathFloor((AccountFreeMargin()*AccountLeverage()*RiskPercent*Point*100)/(Ask*MarketInfo(Symbol(),MODE_LOTSIZE)*
   MarketInfo(Symbol(),MODE_MINLOT)))*MarketInfo(Symbol(),MODE_MINLOT);}}
   if(MM==false){Lots=Lots;}
   int i=0;  
   int total = OrdersTotal();   
   for(i = 0; i <= total; i++) 
     {
      if(TrailingStop>0)  
       {                 
       OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
       if(OrderMagicNumber() == magicnumber) 
         {
         TrailingStairs(OrderTicket(),TrailingStop);
         }
       }
      }
bool BuyOp=false;
bool SellOp=false;
MathSrand(TimeLocal());
double r=MathRand()/32767;
//if (High[Shift1]>High[Shift2]&&High[Shift2]>High[Shift3]&&High[Shift3]>High[Shift4]&&Open[Shift1]>Open[Shift2]&&Open[Shift2]>Open[Shift3]&&Open[Shift3]>Open[Shift4]) BuyOp=true;
//if (High[Shift1]<High[Shift2]&&High[Shift2]<High[Shift3]&&High[Shift3]<High[Shift4]&&Open[Shift1]<Open[Shift2]&&Open[Shift2]<Open[Shift3]&&Open[Shift3]<Open[Shift4]) SellOp=true;
if (r>=0.5) BuyOp=true;
if (r<0.5) SellOp=true;
   if(Time[0] == prevtime) 
       return(0);
   prevtime = Time[0];
   if(!IsTradeAllowed()) 
     {
       prevtime = Time[1];
       return(0);
     }
   if (total < MaxOrders || MaxOrders == 0)
     {   
       if(BuyOp)
        { 
         if (StopLoss!=0)
          {
           OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-(StopLoss*Point),0,"OpenTiks_Buy",magicnumber,0,Green);
          }
         else
          {
           OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"OpenTiks_Buy",magicnumber,0,Green);
          }
        }
       if(SellOp)
        { 
         if (StopLoss!=0)
          {
           OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+(StopLoss*Point),0,"OpenTiks_Sell",magicnumber,0,Red);
          } 
         else 
          {
           OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"OpenTiks_Sell",magicnumber,0,Red);
          }
        }
      }
   
//----
   return(0);
  } 
//+------------------------------------------------------------------+
void TrailingStairs(int ticket,int trldistance)
   {
    int Spred=Ask - Bid;
    if (OrderType()==OP_BUY)
      {
       if((Bid-OrderOpenPrice())>(Point*trldistance))
         {
          if(OrderStopLoss()<Bid-Point*trldistance || (OrderStopLoss()==0))
            {
             OrderModify(ticket,OrderOpenPrice(),Bid-Point*trldistance,OrderTakeProfit(),0,Green);
             if (PolLots)
             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Ask,3,Green);
               }
            }
         }
       }
     else
       {
        if((OrderOpenPrice()-Ask)>(Point*trldistance))
          {
           if((OrderStopLoss()>(Ask+Point*trldistance)) || (OrderStopLoss()==0))
             {
              OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*trldistance,OrderTakeProfit(),0,Red);
             if (PolLots)
             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Bid,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Bid,3,Green);
               }
             }
          }
        }
    }

Your Random number will always result as 0 because you will get integer division (!) and not double. You might correct this as:


double r = MathRand();

r = r/32767;


But even if you do so you will get total different result than original strategy. Try it !

 
yandi_S:

Hi,

I don't understand what this code mean :

             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Ask,3,Green);
               }

My assumption is : It will close the orders if the orders lot is greater than broker minimum lot.

Is that true? If it's true why you should do that?

And what do you mean of

PolLots

int the variable declaration mean?

Thank you.

(sorry for my bad English)

this version of trawl is intended for fleta, by closing of half of plumb line it draws out a large income

Ps.

except for Russian, does not know other

 
zerkmax:
yandi_S:

Hi,

I don't understand what this code mean :

             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Ask,3,Green);
               }

My assumption is : It will close the orders if the orders lot is greater than broker minimum lot.

Is that true? If it's true why you should do that?

And what do you mean of

PolLots

int the variable declaration mean?

Thank you.

(sorry for my bad English)

this version of trawl is intended for fleta, by closing of half of plumb line it draws out a large income

Ps.

except for Russian, does not know other


Hi Zerkmax,

Thanks for answering my question, but could you explain more about this code, I still not understand the logic....

 
yandi_S:
zerkmax:
yandi_S:

Hi,

I don't understand what this code mean :

             if (NormalizeDouble(OrderLots()/2,2)>MarketInfo(Symbol(), MODE_MINLOT))
               {
               OrderClose(ticket,NormalizeDouble(OrderLots()/2,2),Ask,3,Green);
               }
             else
               {
               OrderClose(ticket,OrderLots(),Ask,3,Green);
               }

My assumption is : It will close the orders if the orders lot is greater than broker minimum lot.

Is that true? If it's true why you should do that?

And what do you mean of

PolLots

int the variable declaration mean?

Thank you.

(sorry for my bad English)

this version of trawl is intended for fleta, by closing of half of plumb line it draws out a large income

Ps.

except for Russian, does not know other

Hi Zerkmax,

Thanks for answering my question, but could you explain more about this code, I still not understand the logic....

under reaching desired profita the half of plumb line is closed, at getting up higher - yet half, and so all of warrant will not be closed while

 

Hi,

why your expedrt is skewed to the bear side - you have only one long trade???