[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 41

 
Gentlemen, another question: how (using which operator, for example) can we obtain information about the result of closing an order? Was it a profit, i.e. by TP, or a loss, i.e. by SL? I understood that only by tracking the balance using the AccountBalance? Or is there another way?
 

Use the OrdersHistoryTotal ( ) function to determine the number of closed positions in the history.

Go through the trades in the loop. Select each trade using OrderSelect(...MODE_HISTORY),

Compare the closing price with the SL and TP price.

It is better to compare not strictly, but with a tolerance of 1-3 points, because the close price may not be exactly the SL/TP price, but with a slippage.

 
goldtrader >> :

Use the OrdersHistoryTotal ( ) function to determine the number of closed positions in the history.

Go through the trades in the loop. Select each trade using OrderSelect(...MODE_HISTORY),

Compare close price with price SL and TP.


Thank you for your help and promptness!!!

 
Folks, anyone interested, help me out here. Tried making a Vince volatility channel. It's not rendering. Can you find out where the error is please. I've been looking for it for three days to no avail.
Files:
 
locol91 писал(а) >>
Folks, anyone interested, help to understand. Tried to make a volatility channel according to Vince. It's not rendering. Look where the error is, please. I've been looking for it for three days now with no results.

Just started looking, nothing confusing?

   if ( counted_bars==0) limit=Bars- N; 
   if ( counted_bars>=0) limit=Bars- counted_bars; 

And then there's no confusion at all, why Close[i] when =Bars? How is iMAOnArray used ? The first argument must be an array, you have 1 array element... etdtp

 
Yes. I've already done it by trial and error. Tried all sorts of things. Here is the corrected one. I don't understand about Close[i] with =Bars.
Files:
 

Please advise how to "round up" the date-time to the period of the current timeframe!

I am assuming this option:

datetime X = TimeCurrent(); // или любое другое
datetime Y = X - ( TimeMinute( X) % Period() )

Is this correct and could it be simpler

 
r0mBY писал(а) >>

Please advise how to "round up" the date-time to the period of the current timeframe!

Is it correct and can it be simpler

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

Search for bar by timeframe. The function returns the shift of the bar to which the specified time belongs. If there is no bar for the specified time (a "gap" in the history), the function, depending on the exact parameter, returns -1 or the shift of the nearest bar.

Find the bar and look at its Time[].

If I understand it correctly "rounded")

 
Figar0 >> :

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)

Search for bar by time. The function returns the offset of the bar to which the specified time belongs. If there is no bar for the specified time (a "gap" in the history), the function, depending on the exact parameter, returns -1 or the shift of the nearest bar.

Find the bar and look at its Time[].

If I understand it correctly "rounded")

Yes, that's it. >> Thank you.

 
vikon >> :

I know about opening an order using code.

I need to create a semi-automatic system with management properties.

I open a position manually, but the EA monitors the lot size and changes it by default in MT (service/settings/trading/default volume).

Can I do it?

Not with MQL tools.

Reason: