I don't know how to turn this into a life, can I do that?
My strategy is ideally manually opened at 8:00 on the terminal, if profit, then until the next day. If profit goes not in my direction, then at loss I reverse position + - no matter what, I don't open more positions this day and wait till 8 o'clock in the morning. I.e. there should be a maximum of two orders and no more. If we didn't reach profit, but the Trawl moved to Breakeven, we also rollover. Of course, we can handle everything, but our work does not allow us to monitor positions. It would be better to place an order and let the EA follow the position. I attached RSI just to test it in the Strategy Tester.
This is all I needed.
externint Hour_To_Open = 08; //час открытия (-1 - не задано), терминальное времяexternint Minute_To_Open = 00; //минута открытия (-1 - не задано), терминальное времяexterndouble TakeProfit = 50;
externdouble StopLoss = 30;
externdouble Lot = 0.1;
externint MagicNumber = 655433;
//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+int start()
{
//----if((Hour()==Hour_To_Open) && (Minute()==Minute_To_Open))
{ //если настало время открытия сделокint total = OrdersTotal();
for (int i = 0; i < total; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
return(0);
}
}
int ticket=1;
if(iRSI(NULL,0,14,PRICE_CLOSE,0)>iRSI(NULL,0,14,PR ICE_CLOSE,1))
{
ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,3,Bid - StopLoss * Point,Bid + TakeProfit * Point,"My order #",MagicNumber,0,Blue);
if(ticket<0)
{
Sleep(30000);
}
}
else
{
ticket=OrderSend(Symbol(),OP_SELL,Lot,Bid,3,Ask + StopLoss * Point,Ask - TakeProfit * Point,"My order #",MagicNumber,0,Red);
if(ticket<0)
{
Sleep(30000);
}
}
} //end if((Hour()==Hour_To_Open) && (Minute()==Minute_To_Open))//----return(0);
}
//+------------------------------------------------------------------+
I have this trailing stop, I took it from another EA but it does not work for me
Reverse must be looking for somewhere around here, I take it or not?
bool OrderCloseBy(
int ticket, int opposite, color Color=CLR_NONE)
Closing one open position with another position opened on the same instrument, but in opposite direction. Returns TRUE on successful completion of the function. Returns FALSE when the function fails. To get information about the error, call the GetLastError() function.
Parameters:
ticket
-
Unique serial number of the order to be closed.
opposite
-
The unique sequence number of the opposite order.
Color
-
Colour of the closing arrow on the chart. If the parameter is missing or its value is CLR_NONE, the arrow is not shown on the chart.
Mr. Professionals, could you tell me if it's possible to run a script from the toolbar? At the moment, the written script has to be run either from the navigator, or with a preset combination of keys (which for some reason works only once in a while). Question - can I, for example, assign a new function to the icon in the "graphical tools" panel and run the script from the toolbar? Maybe there are other options?
kon12: Mr. Expert, advise, is it possible to run the script from the toolbar? At the moment, the script has to be run either from the navigator, or using a preset combination of keys (which somehow works only once). Question - is it possible, for example, to assign a new function to the icon on the "graphical tools" panel and run the script from the toolbar? Are there any other options?
No, but you can use drag and drop of Label object as an example ...
Download, extract to terminal with replacement, allow import of dll in terminal setup, attached Expert Advisor to Experts, enter name of script to be launched restart terminal or compile.
The Expert Advisor implements - loads the script on the specified chart by its name when dragging the object on the chart.
ServiceLoadScript(WindowHandle(Symbol(), Period()), "ZZ_All_Quotings 4.10425", /*<---- Имя загружаемого скрипта.*/ false);
Please advise. I am writing an EA that works on channel break, putting two pending ones behind the channel. When one of them triggers, the other should be deleted. How to implement it in the code?
Please advise. I am writing an EA that works on channel break, putting two pending ones behind the channel. When one of them triggers, the other should be deleted. How to implement it in the code?
Perhaps this would be a good idea - I haven't done that myself - if your EA allows only one market order (out of 2 pending ones that were previously placed), then monitor (track) the availability of your (by magician) order (market) in the market and as soon as it shows up, delete the pending one. That is all. If you want to delete a pending order, google something like "delete orders site:mql4.com".
Running the EA on the tester. The server is four digits. When placing buy or sell order in the log says
2011.10.23 15:27:26 2010.12.16 06:16 test_sovetnik GBPUSD,H1: open #1 buy 0.10 GBPUSD at 1.5551 sl: 1.4551 tp: 1.5586 ok
But opens at 1.55512 ! At the five digits. Then the pending orders are placed at four digits and triggered at four digits as well. But OP_SELL and OP_BUY open only by five digits!
I do NormalizeDouble(Ask,Digits);
Nothing works! Please advise how to solve this issue?
You can, of course, ignore the last digit. The error doesn't occur, but for the sake of purity of the experiment, I need all my trades to be made in four digits.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello! Can you tell me how to "loop" the up/down bar check? That is, how can I describe this condition "shorter"?
Close[0]>Open[0]&& Close[1]>Open[1]&& Close[2]>Open[2]&& Close[3]>Open[3]&&& Close[4]>Open[4]&& Close[5]>Open[5]&& Close[6]>Open[6]&& Close[7]>Open[7]
Thanks in advance.
You could do that, but it's not likely to be quicker. The conditions need to be broadened a little
I don't know how to turn this into a life, can I do that?
My strategy is ideally manually opened at 8:00 on the terminal, if profit, then until the next day. If profit goes not in my direction, then at loss I reverse position + - no matter what, I don't open more positions this day and wait till 8 o'clock in the morning. I.e. there should be a maximum of two orders and no more. If we didn't reach profit, but the Trawl moved to Breakeven, we also rollover. Of course, we can handle everything, but our work does not allow us to monitor positions. It would be better to place an order and let the EA follow the position. I attached RSI just to test it in the Strategy Tester.
This is all I needed.
I have this trailing stop, I took it from another EA but it does not work for me
How do I attach it? And reversal, it should work only once after the position is opened
Reverse must be looking for somewhere around here, I take it or not?
if(iRSI(NULL,0,14,PRICE_CLOSE,0)>75) { OrderCloseBy(order_id,opposite_id); return(0); }Good afternoon.
Can you tell me where I can see the original code for the OrderSend() function ?
Thanks in advance.
Mr. Expert, advise, is it possible to run the script from the toolbar? At the moment, the script has to be run either from the navigator, or using a preset combination of keys (which somehow works only once). Question - is it possible, for example, to assign a new function to the icon on the "graphical tools" panel and run the script from the toolbar? Are there any other options?
No, but you can use drag and drop of Label object as an example ...
Download , extract to terminal with replacement, allow import of dll in terminal setup, attached Expert Advisor to Experts, enter name of script to be launched restart terminal or compile.
The Expert Advisor implements - loads the script on the specified chart by its name when dragging the object on the chart.
Good afternoon!!!
Please advise. I am writing an EA that works on channel break, putting two pending ones behind the channel. When one of them triggers, the other should be deleted. How to implement it in the code?
Good afternoon!!!
Please advise. I am writing an EA that works on channel break, putting two pending ones behind the channel. When one of them triggers, the other should be deleted. How to implement it in the code?
Perhaps this would be a good idea - I haven't done that myself - if your EA allows only one market order (out of 2 pending ones that were previously placed), then monitor (track) the availability of your (by magician) order (market) in the market and as soon as it shows up, delete the pending one. That is all. If you want to delete a pending order, google something like "delete orders site:mql4.com".
Hello!
Running the EA on the tester. The server is four digits. When placing buy or sell order in the log says
2011.10.23 15:27:26 2010.12.16 06:16 test_sovetnik GBPUSD,H1: open #1 buy 0.10 GBPUSD at 1.5551 sl: 1.4551 tp: 1.5586 ok
But opens at 1.55512 ! At the five digits. Then the pending orders are placed at four digits and triggered at four digits as well. But OP_SELL and OP_BUY open only by five digits!
I do NormalizeDouble(Ask,Digits);
Nothing works! Please advise how to solve this issue?
You can, of course, ignore the last digit. The error doesn't occur, but for the sake of purity of the experiment, I need all my trades to be made in four digits.
Please advise how to fix an EA, e.g. standard Moving Averages, to turn it into a script in order to run it on a non-standard timeframe.
UP. i would appreciate it if you could tell me how to turn an EA into a script in a nutshell