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

 

I don't quite understand the principle of operation...if you don't mind a simple example...for example C= A + B

Thank you)

 

Hi. I want to know how to set the Expert Advisor to open one order at crossing. If it will close the order with plus or minus, it should wait for the next reverse signal.

The tactic is simple

8EMA>26EMA

MACD(5,13,1)>0 (at the second MACD candle an order is opened)

RSI 21 >(50) OPEN BUY

8EMA<26EMA

MACD(5,13,1)<0 (order opened on the second MACD candlestick)

RSI 21 <(50) OPEN SELL

Thank you for your attention.

 
Hello, the problem is this. When I run the tester, there are no operations.
 

Can anyone suggest an algorithm to check if the last X-orders for a given symbol were

were unprofitable? I have an idea what to do, but I'm afraid it won't be the best option, while the main criteria are

speed of check and minimum load on processor.

Thank you!

 
chief2000:

Can anyone suggest an algorithm to check if the last X-orders for a given symbol were

were unprofitable? I have an idea what to do, but I'm afraid it won't be the best option, while the main criteria are

speed of check and minimum load on processor.

Thank you!

double GetLastOrderProfit()
{
    double profit = 0;
    datetime lastCloseTime = 0;
    int cnt = OrdersHistoryTotal();
    for (int i=0; i < cnt; i++)
    {
        if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
        if (OrderSymbol() != Symbol()) continue;
        if (OrderMagicNumber() != MagicNumber) continue;

        if (lastCloseTime < OrderCloseTime())   // find most recent order
        {
            lastCloseTime = OrderCloseTime();
            profit = OrderProfit();
        }
    }
    return (profit);
}

the function is not mine, but I don't think it's hard to adapt it to the conditions
 

help who can.... someone knows how to make a trailing stop not linear.... and not constant, but only a given number of times

for example when the price moves to A pips loss moves to B pips.... and then when it moves to C move to D

where letters are not the same value but different....

 
IgorM:

The function is not mine, but I think it is easy to modify it according to the necessary conditions

That's the "flowers" :) The most interesting part starts afterwards.

I thought in the first loop to sort orders for a given symbol and create an array by ticket.

In the second loop, sort the array by close time.

But then we should get the order profits from their close time - is it possible to somehow connect them?

without going through all orders? - Otherwise we get too many loops.

 
chief2000:

That's the "flowers" :) The most interesting part starts afterwards.

I thought in the first loop to sort orders for a given symbol and create an array by ticket.

In the second loop, sort the array by close time.

But then we should get the order profits from their close time - is it possible to somehow connect them?

without going through all orders? - Otherwise, we get too many loops.



it means that tickets should be stored in arrays immediately when an order is successfully placed, and then analysis can be done on the tickets

Another variant is to create an additional Expert Advisor that would deal with this - "restore the history" of the terminal and output the data ready to be sent to a file

 
IgorM:


This means that you should memorize the tickets into arrays right away, when an order is successfully placed, and then analyze them

As an option, I would like to create an additional Expert Advisor that would do this - "restore the history" of the terminal and unload the finished data to a file

I don't want to deal with files as a matter of principle, so as not to tie the Expert Advisor to a certain computer...

It looks like I will have to create in the first loop a new array for the tickets of a specified symbol. And then, in two cycles, sort it

it by date, by remembering the tickets in the new array. From the resulting array, run a new loop to check the profit

for the last orders.

 
chief2000:

I don't want to mess with files as a matter of principle, so as not to tie the EA to a specific computer...

It looks like I'll have to create a new array in the first loop for the tickets of a given symbol. And then, in two cycles, sort it

it by date, by remembering the tickets in the new array. From the resulting array, run a new loop to check the profit

for the last orders.


Integer has posted code for working with history. Sort by opening, sort by closing. Just have to look it up.