An advisor that would follow the rate on a five-minute chart with conditions after launch: - page 10

 
I'm going to try to catch up myself now.
 
salesman77:
Delta seems to work...
I need to sell when Delta points are rising and buy when Delta points are falling...

But it was the opposite from the beginning!
 
No. The gist of my idea:
If there is a sharp fall, the pound rolls back a couple of pips and if there is a strong rise too.
If the price went up 30 pips in 5 min, you have to sell with a T/P of only 3 pips. And vice versa :)))
Buy when the price goes down, sell when it rises...
Help, Roman...
 
if (Bid - iOpen(NULL,0,0)>=Delta*Point) //Цена выросла на больше или = Delta пунктов
//продаем-
{
ticket=OrderSend(Symbol(),1,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,
                 "продал",MagicNumber,22222,Red);
 
if(ticket<0){Print("Ошибка открытия ордера SELL #",GetLastError());return(0);}
}
//-------------------------------------------------------------------------
if (iOpen(NULL,0,0)-Bid  >Delta*Point) //цена упала более дельты - покупаем
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,
            "Купил",MagicNumber,11111,Green);
 
if(ticket<0){Print("Ошибка открытия ордера BUY #",GetLastError());return(0);}
}
that's how it's going to be...
 
Thank you very much, it's working now :)
 
salesman77:
Thank you so much, it's working now :)

I mean does it trade or does it profit (which is doubtful)?
 
goldtrader:
salesman77:
Thank you very much, now it works :)

What do you mean, is it trading or profiting (which is doubtful)?
It trades :)
I have my terms and conditions :)
 
One more thing. How to fix this code, so that transactions are performed as a percentage of the deposit?
How to use the Percent function or something like..... but in this code how? :
int start()
{
if (Ask - iOpen(NULL,0,0)>Delta*Point) //Цена выросла  больше Delta пунктов - продаем!!!
//продаем-
{
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"Продал");
 }
//-------------------------------------------------------------------------
if (iOpen(NULL,0,0)-Bid  >Delta*Point) //цена упала больше Delta пунктов - покупаем!!!
{
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,"Купил");
       }
//----
return(0);
}
 
That must be it:

extern int Percent=10;
//-----
int start()
{
if(OrdersTotal()!=0)  return; //Выполнять только одну сделку.
//---
if (Ask - iOpen(NULL,0,0)>=Delta*Point) //Цена выросла  больше Delta пунктов - продаем!!!
//продаем-
{
ticket=OrderSend(Symbol(),OP_SELL,Percent,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,"Продал");
 }
//-------------------------------------------------------------------------
if (iOpen(NULL,0,0)-Bid  >=Delta*Point) //цена упала больше Delta пунктов - покупаем!!!
{
ticket=OrderSend(Symbol(),OP_BUY,Percent,Ask,3,Bid-StopLoss*Point,Ask+TakeProfit*Point,"Купил");
       }
//----
return(0);
}
 
salesman77:
One more thing. How do you fix this code so that the trades are made as a percentage of the deposit?

The results are classified so try to get some knowledge yourself:

- There is a huge library of automatic lot calculations in the kodobase,

- I've got a lot of EAs out there, most of which are equipped with appropriate functions.

Reason: