Coding help - page 662

 
techmac:
Why not using something from here https://www.mql5.com/en/forum/178566
Thank you for your advice however it would still be nice if someone could code the alerts as the Vertical line, which moves all the way down the page gives a accurate visual price crossing sight on any indicators in the secondary or subsequent windows, a further advantage of finding the next entry point.
 
mladen:
That is, more or less, a zigzag. Alerts on it would be almost the same as zigzag alerts (and would suffer from same problemsThan)

Thank you for your reply Mladen --- I agree with your comment but what if the alerts could be programmed in such a way that Alert 1 is activated on the formation of the Vertical line at the close of the candle, making you aware of the potential trend direction change and Alert 2 (the Horizontal line) is activated on the close of the second or third candle after the Vertical line alert and below the highest point reached - when alarm 2 is then activated it should provide a good entry point - if not then don't trade. And yes, the price can break-out even after Alert2  but in all the time that I have been trading and observing I do not think that such an event occurs more than 20%-30%, an acceptable risk. Anyway just a thought for a coder to maybe spend some time on and play around with.

But whilst I have a bit of your attention I would like to ask why it is that HMA/Hull indicators are not programmed to change colours or give alerts when crossing the price (candle) - many pips are lost by the time one enters the trade on the colour change of the HMA/Hull or any other MA Indicator. See my attachment for a visual:  Thank you for your time Mladen - respectfully, a fellow trader :)

Files:
HMA.jpg  188 kb
 

hello mladen

I found a indicator that called "NON LINEAR ATR" its wrtien on easy language (tradestation)

is it possible to convert to mql4?

thank u

 
lbubu:

hello mladen

I found a indicator that called "NON LINEAR ATR" its wrtien on easy language (tradestation)

is it possible to convert to mql4?

thank u

It should be possible

Will check

 
lbubu:

hello mladen

I found a indicator that called "NON LINEAR ATR" its wrtien on easy language (tradestation)

is it possible to convert to mql4?

thank u

This is the part that handles the entries


Files:
 

Dear mladen

I am testing an EA in Trading which uses following simple code to check if an order has been opened. But when I change time frame it opens a new order. The problem is code or I need a multiple time frames EA?!


   int OpenOrder = 0;
   for (int i=OrdersTotal()-1; i>=0; i--)
     {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
        {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber
         && (OrderType() == OP_BUY || OrderType() == OP_SELL)) OpenOrder++;
        }
     }
   return(OpenOrder);


Best,

 
IXI:

Dear mladen

I am testing an EA in Trading which uses following simple code to check if an order has been opened. But when I change time frame it opens a new order. The problem is code or I need a multiple time frames EA?!



Best,

You do not need a multi time frame EA

How do you use this part of code (I mean, how do you prevent the EA from opening a new order if the OpenOrder is > 0)? It has to have a part of code doing that (the code you posted will return correct number regardless of the time frame)

 
lbubu:

hello mladen

I found a indicator that called "NON LINEAR ATR" its wrtien on easy language (tradestation)

is it possible to convert to mql4?

thank u

The version with the exits (stop0 losses) added too

 

Dear friends!
Here is a well known Universal MA Cross expert. It performs well with the right settings and offers great money management and signal filter options, but I would like to ask pro coders to add an option for using moving averages from user defined higher timeframe for crossover signals. The screenshot dispalys the idea of of higher timeframe moving averages (1 hour moving averages plotted on 5 min chart).

Universal MA Cross EA and MTF MA indicator mql files are attached. 

Id be grateful for any help and advises.

 

Files:
 

Dear mladen

Thank for your answer.

It is interesting that the EA just checks if OpenOrder == 0, to send a new order. I don't know if it is enough or it should be checked if OpenOrder is > 0?

You also mentioned that the MetaTrader history is not arranged by orders closing time at least in manual. How consecutive order results should be checked for an EA? I have an idea but I am not sure if it is practical. Something like the following code using arrays for few last orders:

int ConsecutiveResults()
  {
   int Results[] ;
   int Orders = 0;
   ArrayResize (Results,OrdersHistoryTotal()); 
   datetime CloseTime  = 0;   
   for(int i=OrdersHistoryTotal()-1; i>=0; i--)
     {
      if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
      if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderCloseTime() > CloseTime)
      Results[i] = TimeCurrent()-OrderCloseTime();
     }
   ArraySort(Results);
   for(int j=5; j>=0 ; j--)
     {
      for(int k=OrdersHistoryTotal()-1; k>=0; k--)
        {
         if (OrderSelect(k,SELECT_BY_POS,MODE_HISTORY))
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && OrderCloseTime() > CloseTime)
         if (TimeCurrent()-OrderCloseTime() == Results[j] && OrderProfit() > 0) Orders++;
         if (TimeCurrent()-OrderCloseTime() == Results[j] && OrderProfit() < 0) Orders--;
        }
     }
   return(Orders);
}
Best,
Reason: