I have never studied programming, but I want to write an EA - page 4

 
Alexey Volchanskiy:

He wrote that he hadn't studied programming. He must have copied it from somewhere...

So at first I just said that this condition would always be true. And it needs to be corrected, but...

 
Konstantin Nikitin:

So at first I just said that this condition will always give out the truth. And it should be corrected, but...

Well, it is clear to us, but not to TC ))

 
Alexey Volchanskiy:

He wrote that he hadn't studied programming. He must have copied it from somewhere...

I copied it, I got the skeleton of an EA, the skeleton of a function,
and then... That's the problem, using someone else's template, you have to write your own conditions everywhere.

 
anyway guys, i have two copies of the code. they are different. one at home, one at work, i edit where i get a minute.
i'm home now... and the purchase doesn't seem to be kicking in, I'll take a look and see if it clears up, if I just hope there aren't more questions

 
Sergey Lobzankin:
anyway guys, i have two copies of the code. they are different. one at home, one at work, i edit where i get a minute.
i'm home now... and the purchase doesn't seem to be kicking in, I'll take a look and see if it clears up, unless I have any more questions.

Well there's nothing super natural there. So your best bet. Put it out there, but only through

Somebody's got a good idea.

 
Konstantin Nikitin:

Well something super natural you don't have there. So your best bet. is to post it here, but only through

Somebody's got a good idea.

It means that trailing at breakeven is working at home.
if you like, let's compare.
the first variant is the one where the stop loss runs away from the market



and this is the one where Breakeven is triggered but the trailing stop-loss does not go further:

void  Trailig(double ATR)
{
  for(int i = OrdersTotal()-1; i>=0; i--)
  {
    if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
    {
      if(OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
      {
        if(OrderType() == OP_BUY)
        {
          if(Bid - OrderOpenPrice() > TrailingStop*Point || StopLoss == SL)
          {
            if(OrderStopLoss() > Bid -(TrailingStep+TrailingStep)*Point || OrderStopLoss() == SL)
            {
              double takeprofit     = NormalizeDouble(Ask-3*ATR/*Point*/,Digits);
              if(!OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Bid - TrailingStop*Point, Digits), TP/*takeprofit*/, 0))
               Print("Ошибка модификации ордера на покупку!");
            }
          }
        }
 

Sergey Lobzankin:

This is the one where Breakeven is triggered, but the trailing edge does not crawl any further:

What are StopLoss, SL, ATR? It's just desirable to know the full terms of what you want to check to satisfy your TS.
 
Konstantin Nikitin:
What are StopLoss, SL, ATR? It is just desirable to know the full terms of what you want to check to satisfy your TS.

ATR = average number of pips in a bar in a selected period (ATR indicator)
SL= variable which represents Stoploss value from the formula

 
Konstantin Nikitin:
What are StopLoss, SL, ATR? Just preferably full conditions to know what to what you want to check to satisfy your TS

Dear Konstantin!!!
I understand it all. but i'm sorry guys, i cannot afford to lose the code completely. so you can write your TS on the strategy and sell it? i have asked for your advice and i continue to do so

 
What I also want to ask is, how can I send a questionable line from the same log to the logbook via Print?