Coding help - page 706

 
lea26:

Hi Mladen, I have downloaded your

stepma_pdf_4_4.ex4 as well as the histgram,

copied them into MT4. Draging them onto the chart window

I get the following message, pls see in the image:

Would you tell me how I can use your indicator?


Lea


ps. the same happend with: averages_-_mtf__alerts_7_4.ex4 and histogram

Use these :

 
mladen:

Use these :

Thank you again!! , when you have some spare time ... hope you like fish


Lea

 
lea26:

Thank you again!! , when you have some spare time ... hope you like fish


Lea

Which one of fish,the laying near around ?
 

hello mr mladen:

please update it

 

regard 

 
bilbao:

hello mr mladen:

please update it

 

regard 

Try now.

 
mntiwana:

Try now.

REGARD
 
mntiwana:
Which one of fish,the laying near around ?
Mermaid
 
mladen:

Do you have only 1 order (same magic,symbol I mean) opened at the same time?

If yes, then it will work.

Hi Mladen,

thank you for your advise. Yes the EA will just trade one position.

I will implement the code and run some tests with it..

Have a nice week. 

 

hi---

can any1   make a code (indicator or script ) makes mt4 holidays as empty candle --at  axis's time---


Good Luck to all 

 
tfi_markets:

Dear pro-coders,

I would like to implement "four trades per day" feature into my EA. If the maximum trade limit 

is reached the EA should wait until the next day to continue trading. 

I wonder if someone could review my code, I have a bit of a "brain freeze" here... ;-)

Thank you in advance! 

  

extern int    MaxShortTrades   = 2;
extern int    MaxLongTrades    = 2;

// Count Trades per Day.

   int y;
   int totalOrders = 4;
   datetime toT; // Time of Trade
   datetime doT; // Day of Trade
   datetime now = TimeCurrent();
   datetime boD=now-now%86400; // Beginning of day

   for(y=0;y<totalOrders; y++)
     {

      if(OrderSelect(y,SELECT_BY_POS,MODE_HISTORY))
        {
         toT=OrderOpenTime(); // Time of Trade
         doT=toT-toT%86400; // Day of Trade.
         if(doT==boD)
           { // Time of Trade within Current Day.

            for(j=OrdersTotal()-1;j>=0; j--)
              {
               if(OrderType()==OP_BUY)  totalOrders++;  // Check # of long trades.
               if(OrderType()==OP_SELL) totalOrders++; // Check # of short trades
              }

           }
        }
     }

   if(totalOrders<MaxLongTrades  &&  Indicator_LONG_signal) Order=SIGNAL_BUY;
   if(totalOrders<MaxShortTrades && Indicator_SHORT_signal) Order=SIGNAL_SELL;

In order to check both history (for orders closed at the current day) and opened orders, try like this :

   datetime today = StringToTime(TimeToString(TimeCurrent(),TIME_DATE));
   int totalOrdersLong  = 0, totalOrdersShort = 0;  
      for(int y=OrdersHistoryTotal()-1;y>=0; y--)
      {
         if (OrderSelect(y,SELECT_BY_POS,MODE_HISTORY))
         if (OrderCloseTime()>=today)
         {
            if (OrderType()==OP_BUY)   totalOrdersLong++;
            if (OrderType()==OP_SELL)  totalOrdersShort++;
         }        
      }
      for(int y=OrdersTotal()-1;y>=0; y--)
      {
         if (OrderSelect(y,SELECT_BY_POS,MODE_TRADES))
         if (OrderOpenTime()>=today)
         {
            if (OrderType()==OP_BUY)   totalOrdersLong++;
            if (OrderType()==OP_SELL)  totalOrdersShort++;
         }        
      }

   if(totalOrdersLong <MaxLongTrades  && Indicator_LONG_signal) Order=SIGNAL_BUY;
   if(totalOrdersShort<MaxShortTrades && Indicator_SHORT_signal) Order=SIGNAL_SELL;  
Reason: