Ea that counts the amount of the wining trades in the initial.
If (win) Winers ;
today I would like it to count just from the last fifty transactions.
And afer evry commerce, it'll updated to the new last fifty (like MA).
IS THERE AN EASY WAY??
Ea that counts the amount of the wining trades in the initial.
If (win) Winers ;
today I would like it to count just from the last fifty transactions.
And afer evry commerce, it'll updated to the new last fifty (like MA).
IS THERE AN EASY WAY??
Say you have an array that contains all of your Net profits over 100 transactions, call your Net_profit_Array,
if you would like just the previous 50 trades from this variety, then you can create a new array, let's call it New_array, using https://docs.mql4.com/array/arraycopy and defining where you need to start copying from the original array by placing the src_start parameter to 50 as follows:
ArrayCopy(New_array,Net_profit_Array,0,50,WHOLE_AR RAY);
This may save the past 50 transactions of the original array into New_array, and then you can certainly do your computations as usual on this copied array.
Naturally, you would want to set the src_start parameter to a factor if the size of the original Net_profit_Array keeps on changing.
Good luck!
however how to make this Net_profit_Array, automaticly?Originally Posted by ;
Where would you counting your winning transactions from in the first place? That is your Net_profit_Array. Glue all your code, and I'll attempt to explain.Originally Posted by ;
Good luck!
Once the ea closes a trade:Originally Posted by ;
(profit is the profit/loss of this trade, in $)
if (profitgt;0) // winner trade
Number_of_winners ;
if (profitlt;0) // reduction
number_of_losses ;
Last_50_trades_result();
// ------------------------------------------------------------------
//Closing 50 trades result
// ------------------------------------------------------------------
void Last_50_trades_result()
wins = 0;
Sheds = 0;
int depth_trades = 50;
int total_trades = OrdersHistoryTotal();
int limit;
if(total_trades gt; depth_trades)
Restrict = total_trades - depth_trades;
else limit = 0;
for(int I=total_trades; igt;=Limitation; I--)
OrderSelect(I,SELECT_BY_POS,MODE_HISTORY);
if(OrderProfit() gt; 0)
wins ;
if(OrderProfit() lt; 0)
Sheds ;
**** MODE_HISTORY Close the gap between HI and Also STORY
THANK YOU VERY MUCHOriginally Posted by ;
(and welcome to ff)
if (Last_50_trades_result() ==true) anax =;
thank youit works alright.Originally Posted by ;
However, the OrdersHistoryTotal() counts expired pending orders.
How can I prevent it from include them?
Attempt thisOriginally Posted by ;
Inserted Code // ------------------------------------ ------------------------------ //Last Minute trades lead // ------------------------------------ ------------------------------ int Last_N_trades_result(int depth_trades) { int wins = 0; int counted_trades=0; int total_trades = OrdersHistoryTotal(); for(int I=total_trades; igt;=0; I--)
thank youOriginally Posted by ;
but it doesnt works for me
https://www.forexsoutheast.asia/atta...1174942499.mq4