[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 464

 
TarasBY:
Didn't notice it right away. As an option (I would do it necessarily), make the normalisation of the lot value passed to the token function.
There was such a thought. I will try it now. Thank you.
 
nemo811:

Meaning?

?

Tried it - it doesn't work.


Slippage, after the opening price, at least 30 for a 5!
 
borilunad:

Slippage, after the opening price, at least 30 for a 5!
Ah, I see what you mean.I have the deviation set.
 
nemo811:
That was my idea. I will try it now. Thank you.

Also, some brackets are not placed correctly:

    for (i=OrdersTotal()-1;i>=0;i--)
    {
        if (!OrderSelect (i, SELECT_BY_POS, MODE_TRADES))
        {Alert ("Ошибка ", GetLastError(), " выбора ордера!");}
        else
        {
            SMB = OrderSymbol();
            SchBuyLotsSMB = 0;
            SchSellLotsSMB = 0;
            for (ii=OrdersTotal()-1;ii>=0;ii--)
            {
                if (!OrderSelect (ii, SELECT_BY_POS, MODE_TRADES))
                {Alert ("Ошибка ", GetLastError(), " выбора ордера!");}
                else
                {
                    if (OrderSymbol() == SMB)
                    {
                        if (OrderType()==OP_BUY) {SchBuyLotsSMB +=OrderLots();}
                        if (OrderType()==OP_SELL) {SchSellLotsSMB += OrderLots();}
                    }
                }
            }
            MarketLotSMB=SchBuyLotsSMB-SchSellLotsSMB;
            if (MarketLotSMB == 0.0) continue;
            RefreshRates();
            if (MarketLotSMB<0)
            {
                MarketLotSMB = MathAbs (MarketLotSMB);
                Price = MarketInfo (SMB, MODE_ASK);
                OPENORDER ("Buy", SMB, MarketLotSMB, Price);
            }
            else if (MarketLotSMB>0)
            {
                Price = MarketInfo (SMB, MODE_BID);
                OPENORDER ("Sell", SMB, MarketLotSMB, Price);
            }            
        }
    }

and we also need to take into account that in the second cycle there is an order reassignment and after the second cycle (if it's not a tester), for example, SMB could be != OrderSymbol().

 
TarasBY:

Also, some brackets are not placed correctly:

and you also have to take into account that in the second cycle there is an overallocation of orders and after the end of the second cycle (if it's not a tester), for example, SMB could be != OrderSymbol().

Bravo! Your variant works.

Thank you sincerely.


borilunad- thank you also.

 
TarasBY:

Also, some of the brackets are wrong:

I put the brackets correctly in my own version and it worked, too.

Thanks again.

 

granit77

I disagree. No need to go beyond mql, no need to remove the EA from the chart. It is enough to programmatically block trading by providing this in the EA code.

Zhunko:
Yes! Right! Exception only for remote control.

Thanks for the feedback, but I still don't know which is better and I have chosen:

PostMessageA(WindowHandle(Symbol(),Period()), WM_COMMAND, 33050, 0);

Now I have another question. What should I add to the code so that it will not go off immediately, but after a certain amount of triggering (for example:Kol=3)

#property show_inputs
#include <WinUser32.mqh>
extern int Kol=3;

int start()
{
OrderSend(Symbol(),OP_SELL,0.05,Bid,333,0,0,"Тест",0,0,CLR_NONE);
while(!IsTradeAllowed()) Sleep(1000);
PostMessageA(WindowHandle(Symbol(),Period()), WM_COMMAND, 33050, 0);
return(0);
}

Thanks in advance

 

Hello!

I have started building an EA for Aroon indicator. I have never wanted to use indicator which is not already included in MT4. I CAN'T GET IT TO WORK: (((((

I am not going to use Aroon indicator in MT4 but I have to use it in Aroon.

Files:
 
Sarguss:

Hello!

I have started building an EA for Aroon indicator. I have never wanted to use indicator which is not already included in MT4. I CAN'T GET IT TO WORK: (((((

I can't get a hint or suggest my mistakes.

This is VERY interesting code:

Up1 = Highest(Symbol(),"Aroon_Horn2",MODE_HIGH,Aroon_Period-1,0);
 Up2 = Highest(Symbol(),"Aroon_Horn2",MODE_HIGH,Aroon_Period-1,1);
      Dn1 = Lowest(Symbol(),"Aroon_Horn2",MODE_LOW,Aroon_Period-1,0);
   Dn2 = Lowest(Symbol(),"Aroon_Horn2",MODE_LOW,Aroon_Period-1,1);

Highest() and Lowest() are user functions? If not, where did you find such a construction?
If you want to get values from the indicator, you should use iCustom() function.

 
TarasBY:

This is a VERY interesting code:

Are Highest() and Lowest() custom functions? If not, where did you find such a construct?
If you want to get values from the indicator, you should use iCustom() function.

This I intuited from the indicator. Must be funny :)

Is this the only bug?

When I put the Expert Advisor on Demo, it says "2012.10.26 21:49:56 2012.10.22 23:59 Trommel 300+Aroon CADJPY,H1: invalid integer number as parameter 2 for iLowest function

2012.10.26 21:49:56 2012.10.22 23:59 Trommel 300+Aroon CADJPY,H1: invalid integer number as parameter 2 for iHighest function" But the intersection Up & Down works.