[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 410

 
abolk:


1. Bar open time https://docs.mql4.com/ru/series/iTime

2. Run through all open orders and compare their open times https://docs.mql4.com/ru/trading/OrderOpenTime

3. Run through all closed orders and compare their open times


Erm... I'm a bit slow on the uptake... I can't figure out OrderSelect, can you write ready-made code, so it can be already inserted into EA ? How to know when last order was opened (in order history (because the order has already closed at breakeven for example)...

like

TimeOp = ... and here is the code ))

 
Shniperson:
Can you write a ready-made code so that it can already be inserted into an EA ?
одна сделка в баре
datetime Time_=0;// вверху
if(Time_!=Time[0]){ OrderSend(...OP_BUY...); Time_=Time[0];} //в старт
 

re-posted

azik1111:

i was recommended here ))) well, let's see if it works )) even if it's just a joke, why not support it )))

extern double StopProfit = 5; -------- is an external variable, a real number. my question is why i can't set it to negative values. if i set a negative value, the EA will just place orders and delete them instantly. as i remember, real numbers are all numbers and zero.

Here are 2 more lines in my EA with this parameter :

first in : expert start function

"StopProfit=", DoubleToStr(StopProfit, 2), AccountCurrency());

second in : Manage orders and positions.

if (GetProfitOpenPosInCurrency(NULL, -1, Magic)>=StopProfit)


TheXpert:
What's not clear? As soon as an order is opened, it is immediately closed by a profit which is negative but greater than the set value.
 
sergeev:

moved to




the close condition cannot work because the orders are pending and there is no total profit or loss in the currency .
 

Good afternoon, please.

1. Advise where in the body of the EA is better to write the code that should display messages in the chart (eg, the level of spread, etc.), that is, with each tick to display the information.

2. Is it possible to pass some parameters with bool XXX and bool YYY into void function (void ScreenMessage (bool XXXX, bool YYY). In this case a compile-time error will pop up, how can I get around it?

 

1. wherever you can get it

2. you can get around the compilation error by writing your own compiler.

 
Good day to all! Some advice for a beginner. There is a 2MA EA, how and where to redirect it to trade on custom indicator BWAosig. I am very interested in the clear example. The EA and the indicator are enclosed. Many thanks in advance.
Files:
bwaosig.mq4  4 kb
 
expert
Files:
 
isaev-av:
You can find the help at .


You should see the following in the Expert Advisor

ma1=iMA(NULL,0,MovingPeriod1,MovingShift,MODE_SMA,PRICE_CLOSE,0); - It will read it from the mouse
ma2=iMA(NULL,0,MovingPeriod2,MovingShift,MODE_SMA,PRICE_CLOSE,0);
ma3=iMA(NULL,0,MovingPeriod1,MovingShift,MODE_SMA,PRICE_CLOSE,1);
ma4=iMA(NULL,0,MovingPeriod2,MovingShift,MODE_SMA,PRICE_CLOSE,1);

These lines should be replaced with iCustom (the name of the indicator and its parameters). If you want to change the name of an iCustom line, you should fill it in MetaEditor (the programmer should work in it), then press F1 and everything will be described in details.

 

Gentlemen! How to make a time restriction on trading... so that the Expert Advisor does not trade from 23-00 to 2-00 (terminal time)

As I understand it...

let's say ... How do I write the numeric value of time? through a colon... or time must also be specified in the code somehow?

T = iTime("USDCHF",PERIOD_M15,0) ....... if (...... && T<23:00& T>02:00)