[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 422

 
klopp:
Gentlemen programmers! Please help me to write an Expert Advisor based on the i-Regr indicator.
The principle is idiotically simple...
When the value of the indicator's upper line (value2) is above 1.43 there is one sell deal, when the value of the indicator's lower line (value3) is below 1.40, the sell is closed and one
buy deal is done, which is closed when value2 is above 1.43. The values 1.40 and 1.43 I chose approximately, because
need to adjust depending on the timeframe, so it is desirable that they can be changed in the properties of the EA, but not in the program, because I am not too shabby in programming.

Thanks in advance to anyone who responds.
formayl@mail.ru

After reading your exchange, I decided to call myself an idiot. Since this is a branch of helping those who try to program themselves, then my price is 100 USD and three hours after the payment in WebMoney you have an EA, which will work for real (not a toy for the demo). Contact me in the personal area.

ZS. Completely forgot - bargaining is appropriate and encouraged (upwards, of course)

 

The indicator is attached to the same chart as the EA, I take data from the indicator, which is then processed in the EA. The question is that I need to get data from the indicator not only on the pair whose chart is open, but also on 4 to 5 other pairs.
How to implement this? How to make it possible to test it in the strategy tester?

 
nuan:

The indicator is attached to the same chart as the EA, I take data from the indicator and then it is processed in the EA. The question is that I need to get the data from the indicator not only for the currency pair whose chart is open, but for 4-5 pairs as well.
How to implement this? How to make it possible to test it in the strategy tester?

here https://docs.mql4.com/ru/indicators/iCustom

specify the required pair and the required time frame as parameters string symbol, int timeframe - the indicator does not have to be attached to the chart

the multiset is not tested in the tester, only in MT5 (MQL5)

 
Thank you so much!
 
KONDOR:


Suggestion is good, thanks, BUT THIS IS SLOW TO WORK!!! question is open

"I have an EA, how can I make it understand that an order previously placed by it (including a pending order) no longer exists (for various reasons - it triggered sl or TP or was manually deleted), that is, how to make it ask whether the order is alive or not. Those commands that are in the editor returns values, but here the value is not clear.

 

What is the error, why is it not working. I would like to draw a line from 0 to 24 hours by price DnPrice

if (!ObjectCreate("Down",OBJ_TREND,0,0:00,DnPrice,24:00)) //resign lines
{
Print("error: can't create Down! code #",GetLastError());
return(0);
}

ObjectSet("Down",OBJPROP_COLOR,Red);

 
Stells:

What is the error, why is it not working. I want to draw a line from 0 to 24 hours at the price of DnPrice

if (!ObjectCreate("Down",OBJ_TREND,0,0:00,DnPrice,24:00)) //resign lines
{
Print("error: can't create Down! code #",GetLastError());
return(0);
}

ObjectSet("Down",OBJPROP_COLOR,Red);

https://docs.mql4.com/ru/basis/types/datetime

bool ObjectCreate( string name, int type, int window, datetime time1, double price1, datetime time2=0, double price2=0, datetime time3=0, double price3=0)

 
bercut0077:

Suggestion is good, thanks, but it is slow to work!!! question is open

"I have an EA, how can I make it understand that an order previously placed by it (including a pending order) no longer exists (for various reasons - it triggered sl or TP or was manually deleted), that is, how to make it ask whether the order is alive or not. Those commands that exist in the editor return values, but here the value is not clear.


It is very easy - there is a function OrdersHistoryTotal - go through the history and see if the order with the required magician is in the history, it means it is closed or deleted.

We could also add some conditions in the loop of history orders sorting. For example, if the time of order closing is less than the opening time of today, we will ignore such an order. As a result, the Expert Advisor will sift out orders that were closed/deleted today only.

 
nuan:
ZZZEROXXX why should it make a profit?

Because if you flip the chart, the chart grows )))) I don't think it's just about the spread, if we assume there aren't many trades then the spread doesn't play a decisive role in profitability.
 

Tell me, for a remote order, is it possible to know if it was closed at TakeProfit or not?

Can I use the

double OrderTakeProfit( )
Returns the closing price when the profit margin (take profit) for the currently selected order has been reached
The order must be pre-selected using the OrderSelect() function.
?

Can we create a condition like this

for ( i=OrdersTotal();i>0;i--){ OrderSelect(i,SELECT_BY_POS,MODE_HISTORY  );
if( OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol()&&OrderTakeProfit( )>0 ||
   OrderMagicNumber( )==1000 &&OrderSymbol()==Symbol()&&OrderTakeProfit( )>0

Wouldn't this function return more than zero for any order if it was closed, like what would be the profit?

Reason: