I will write an advisor free of charge - page 19

 
MIR_KAZAN:
How do I insert in OrderSend TP, Sl, so that SL contains the High of the previous candle and TP of the Low of the previous candle + TakeProfit ?

For example, like this:

    int ticet  = 0;
    double Stop =0;
    double Take =0;
    Stop = NormalizeDouble(Low[1]-StopLoss*Point,Digits); 
    Take = NormalizeDouble(High[1]+TakeProfit*Point,Digits);
    ticet=OrderSend(Symbol(), OP_BUYLIMIT, Lots, High[1],10, Stop, Take,"Set bu ForexRobot",Magic,0,clrNone);
    if (Ticet==0) Print("Ошибка открытия ордера BUY LIMIT");
    Stop = NormalizeDouble(High[1]+StopLoss*Point,Digits); 
    Take = NormalizeDouble(Low[1]-TakeProfit*Point,Digits);
    Ticet = OrderSend(Symbol(), OP_SELLLIMIT, Lots, Low[1],10, Stop, Take,"Set bu ForexRobot",Magic,0,clrNone);
    if (Ticet==0) Print("Ошибка открытия ордера SELL LIMIT"); )

In addition, please note that the 4th parameter of the OrderSend() function, the price at which the BUY LIMIT order will be set, must be lower than the current price. And for a SELL LIMIT order, this parameter should be higher than the current price. If you need to set a BUY pending order above the current price, you should use order type OP_BUYSTOP. Read the help on how STOP orders differ from LIMIT ones.

I would also add a check to see where the current price is at the moment of placing the order.

if (Bid>High[1])
   ticet=OrderSend(Symbol(), OP_BUYLIMIT, Lots, High[1],10, Stop, Take,"Set bu ForexRobot",Magic,0,clrNone);
.....
if (Ask<Low[1])
    Ticet = OrderSend(Symbol(), OP_SELLLIMIT, Lots, Low[1],10, Stop, Take,"Set bu ForexRobot",Magic,0,clrNone);

If I have understood your idea correctly, it should look like this

if the current price is below the minimum of the previous candle, then we will place an SELL LIMIT order at the minimum of the previous candle;

If the current price is above the maximum of the previous candle, then BUY LIMIT on the maximum of the previous candle.

 
Good day to you all!
I am a total zero in MQL.
I have some skills in mathematics.
I want to do some research on the market.
But I need an EA for that.
The actions of an EA are elementary.
Who can help and explain how to work with it for testing the market history?
If anyone is just learning to program in MQL, I would also be glad to help. And for the trainee it will be a kind of practice.
I am able to write a very clear ToR, but in my own words.
If anyone can help, please write your contacts.
 
Inoy_13:
Good day to you all!
I am a total zero in MQL.
I have some skills in mathematics.
I want to do some research work on the market.
But I need an EA for that.
The actions of an EA are elementary.
Who can help and explain how to work with it for testing the market history?
If anyone is just learning to program in MQL, I would also be glad to help. And for the trainee it will be a kind of practice.
I am able to write a very clear ToR, but in my own words.
If anyone can help, please write your contacts.
Maybe you should contact the service work?
 
Alex2356:
Maybe you should get a service job?
So the topic is for freeloaders).
 
zfs:
So the topic is for freeloaders).
ah... excuse me)))
 

Greetings, can anyone tell me how to write a function, I've created a topic and there's silence... I guess everyone's here.

https://www.mql5.com/ru/forum/43095

Thanks in advance.

Помогите написать функцию. Фракталы...
Помогите написать функцию. Фракталы...
  • www.mql5.com
я читал что в массиве первый записанный элемент хранится в конце. - - Категория: эксперты форекс, торговые роботы и советники
 
vitales:

For example, like this:

In addition, please note that the 4th parameter of the OrderSend() function, the price at which the BUY LIMIT order will be set, must be lower than the current price. And for a SELL LIMIT order, this parameter should be higher than the current price. If you need to set a BUY pending order above the current price, you should use order type OP_BUYSTOP. Read the help on how STOP orders differ from LIMIT ones.

I would also add a check to see where the current price is at the moment of placing the order.

If I have understood your idea correctly, it should look like this

if the current price is below the minimum of the previous candle, then we will place an SELL LIMIT order at the minimum of the previous candle;

If the current price is above the maximum of the previous candle, then BUY LIMIT on the maximum of the previous candle.



How do I make my EA work only on Monday?

 
yakton:
If you have a good strategy and are willing to share it, I can write an EA. I invite you to discuss it either publicly or in private messages.
I have a couple of thoughts about an automated strategy. You just need to think it through, and one version will not do.
 
MIR_KAZAN:



How do I make my EA work only on Mondays ?

You need function DayOfWeek(). Returns the number of day of the week. For Monday, it will be 1. Please read the help for more details.
 
Vitalii Ananev:
You need the DayOfWeek() function. Returns the sequence number of the day of the week. For Monday it will be 1. For more details, please read the help.
Why in the beginning of the test is the Expert Advisor profitable, but on the last day of the tester it is losing money?
Reason: