Download MetaTrader 5

EA: Miscellaneous Questions - Trading Strategy - page 3

To add comments, please log in or register
Max Enrik
1000
Max Enrik  

I fixed it with below code.

if( Hour() <= 10 || Hour() > 20 ) return;
Max Enrik
1000
Max Enrik  

Below code does not work consistently. Sometimes works correctly sometimes not. I can't figure out. I already checked positions, all orders passes over 120 pips. ( 0.0012 for EURUSD ).

What can do for it, please? ( I am hard working on it )

Thanks in advance.

( I hope I will get answer soon )

void tradebuy()
{
    int distance = 100;
    // Trailing Stop
    for ( int i = _OrdersTotal - 1; i >= 0; i-- )
    {
        if  ( ! OrderSelect( i, SELECT_BY_POS ) ) continue;
        if  ( OrderOpenPrice() < OrderStopLoss() ) continue;
        if  ( OrderSymbol() != Symbol() ) continue;
        if  ( OrderType() != OP_BUY ) continue;
        if  ( Bid < OrderOpenPrice() + OrderSwap() + OrderCommission() + distance ) continue;

        bool res = OrderModify( OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + OrderSwap() + OrderCommission(), OrderTakeProfit(), 0, clrBlue );
        if  ( ! res ) Print( "error #", GetLastError() );
        else Print( "order modified successfully." );
    }
}

Strategy Tester Trailing Stop

whroeder1
15567
whroeder1  
        if  ( Bid < OrderOpenPrice() + OrderSwap() + OrderCommission() + distance ) continue;
What does Bid (1.12345) have to do with profit ($1000)
Max Enrik
1000
Max Enrik  
whroeder1:
What does Bid (1.12345) have to do with profit ($1000)

Now it works good.

Thanks for your nice question.

if  ( Bid < OrderOpenPrice() + OrderSwap() + OrderCommission() + distance * Point ) continue;
Max Enrik
1000
Max Enrik  

My Custom Indicator ( CI ) have Arrow Objects for Periods. When I call that my CI from my Trading Strategy then I see that Arrow Objects, but I do not want to see that Objects.

Q:  What can I do for it, please?

Thanks in advance.

Marco vd Heijden
Moderator
5098
Marco vd Heijden  
can you illustrate a bit more the problem please?
Max Enrik
1000
Max Enrik  
Marco vd Heijden:
can you illustrate a bit more the problem please?

Yes, of course.

Thanks in advance.

indicator example chart 07

Marco vd Heijden
Moderator
5098
Marco vd Heijden  
Haha well you have to find and fix the code that puts the dot there ...
Max Enrik
1000
Max Enrik  
Marco vd Heijden:
Haha well you have to find and fix the code that puts the dot there ...

Hehe! But my indicator works Perfectly. That issue only appear when I call that CI from Trading Strategy.

And I need to know what could I do for it, please?

Marco vd Heijden
Moderator
5098
Marco vd Heijden  

It must be created somewhere so find it.

Maybe its a bug ?

1234
To add comments, please log in or register