Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 282

 
alexey1979621:

Hello to all forum members.

Any advice from knowledgeable people? I have an EA that opens trades on indicator signal, how to prescribe a signal counter programmatically, i.e. after taking Take Profit or closing an order on a Trailing Stop, the EA skips the next two signals and does not open trades.

I would appreciate any help.


I do not know what I want but please advise how to implement it.

What exactly do you mean by skipping signals?

1) A virtual trade? as if we open a dummy position, monitor, close also dummy ( Ilanim);

2) Try to use the signal after a certain period of time, a new signal may be received in ХХХ minutes;

3) Evaluation of the signal after a certain amount of bars? A new signal can be received after ХХХ bars;

..................

Also, any other requests:

replace the construct if(Volume[0]>1) return; it won't always trigger already on demo, let alone real;

Isn't it possible to get by with one condition more?

if (StopLoss >= STOPLEVEL)         //    if (StopLoss > STOPLEVEL) так не проще?
   if(StopLoss > 0)

the logic is not correct, else handles the second condition:

if (StopLoss >= STOPLEVEL)
   if (StopLoss > 0){
      SL = Price + StopLoss*Point; // вычисляем стоплос
      SL = NormalizeDouble(SL, Digits); // округляем до нужного нам числа цифр после запятой
   }
   else SL = 0;

and many more...

 
ALXIMIKS:


I want something I don't know what, but tell me how to implement it.

What exactly do you mean by missing signals?

1) A virtual trade? as if we open a fictitious position, monitor it, close it fictitiously too ( Ilanim);

2) Try to use the signal after a certain period of time, a new signal may be received in ХХХ minutes;

3) Evaluation of the signal after a certain amount of bars? A new signal can be received after ХХХ bars;

..................

Also, any other requests:

replace the construct if(Volume[0]>1) return; it won't always trigger already on demo, let alone real;

Isn't it possible to get by with one condition more?

the logic is not correct, else handles the second condition:

and many more...

I'm a novice writer, i.e. I'm getting to everything myself, the main thing is that it works. if(Volume[0]>1) works fine both on the real and on the demo, and in the tester. I have written my wishes quite clearly. A deal is opened based on the indicator signal (I have attached the condition of deal opening in the code). After the previous trade was closed at Take Profit and Trailing Stop, I need to skip 1 or 2 or 3 (adjustable parameter) signals from the indicator, i.e. not open a trade. I do not know how to prescribe it programmatically, that is why I am asking for help.
 

Good day to all!) I've recently got interested in MQL and now I've run into the first problems. The idea is that the EA opens positions according to the function but does not want to close them, and therefore these market orders without stops are placed till the end of the test session. The question is where I made my mistake.

Here is a close fragment:

 if(Level >= 0.000100 && LevelXP>LevelXM && CountSell() > 0)
          {
               for(i=OrdersTotal()-1; i >= 0; i--)
               {
                   if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
                   {
                       if(OrderMagicNumber() == Magic && OrderType() == OP_SELL)
                          OrderClose(OrderTicket(), OrderLots(), Ask, Slippage);
                   }
               }
          }
 
ElhoroS:

Good day to all!) I've recently got interested in MQL and faced the first problems. The idea is that the EA opens positions according to the function but does not want to close them, and therefore these market orders without stops are placed till the end of the test session. The question is where did I go wrong?


1) Perhaps the problem is in the closing conditions (you gave it implicitly)

2) You have only closed OP_SELL in this code (did you remember to implement conditions to buy? Make sure that the conditions for closing are correct).

3) When checking during brute force, you don't check the currency pair and time frame (why should I do it again?)

4) There is no check for requotes (in the Strategy Tester everything should be fine, but on the demo or real account - not always)

5) As Artemis artmedia70 declared, MarketInfo(Symbol(),MODE_ASK) is better thanAsk - it gives more actual prices

 
ALXIMIKS:


5) As Artemis stated MarketInfo(Symbol(),MODE_ASK) will be better thanAsk - more relevant prices will be given

No... enough with the name-calling...
 
artmedia70:
Nah... enough with the name-calling...


Yes, I remember the last situation, Artyom, I'm sorry - it stuck.
 
ALXIMIKS:

Yes, I remember the past situation, Artem, I'm sorry - it stuck.
Artyom+Femis=Artemis; Be proud, Artyom! It's a confession! I wish you to keep it that way!
 
borilunad:
Artyom + Themis = Artemis; Be proud, Artyom! It's a confession! I wish you to keep it up!
 
artmedia70:
Where do the pictures come from and how do you do it? True, these characters do not represent Themis.
 
ALXIMIKS:


1) The problem may be in the closing conditions (you have given them implicitly).

2) In this code, you close only OP_SELL (did not you forget to implement buying? Make sure that the conditions for closing are correct).

3) When checking during brute force, there is no check for currency pair and time frame (why would you run and add them later?)

4) There is no check for requotes (in the Strategy Tester everything should be fine, but on the demo or real account - not always)

5) As Artemis artmedia70 declared, MarketInfo(Symbol(),MODE_ASK) is better thanAsk - it gives more actual prices


1) Level = iMACD(Symbol(), 0, FastEMA, SlowEMA, SignalSMA,PRICE_WEIGHTED, MODE_MAIN, 0);

2) I didn't insert OP_BUY, operations are the same, but it does not close both buy and sell.

3) I do not quite understand about the overshoot; this EA accepts only one order in one direction per timeframe and chart symbol (my dilettante conclusions)

And the last two points are not clear at all)))) sorry for incompetence.

I've been in MQL-programming for three days, that's why I still have a lot on my mind.

I have not registered problems with re-quotes and what may be the problem with the opening.

Reason: