[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 384

 
KostelloArtua:

Hello!

Question: I wrote an EA that works on the tester. Works on MetaTrader4 at only one broker out of 2, just the one I don't need. And where I need it, it doesn't work..... What could be the problem?????? Thanks in advance....

You have answered your own question. There are a huge number of left-handed brokerage companies in the Forex market. Where your capital is not deposited at all, but lies with your brokerage company. They have a simple arehmetic 90% of deposits are ploughed into their pockets. And they are such masters (or rather pros) their job is that you do not make any money. And until you figure out what to do, they will leave more than one deposit in their pockets. My advice is to look for a broker with tight spreads. I personally have a spread of 0.8 for a full lot

(100.000 lot spread is 8 USD, most brokers have from 30 to 50 $) which makes a big difference. I personally trade from Deutsche Brokerbank where there are no intermediaries. And the terminal works with the Exchange and not inside the office.

 
Vinin:

I guess you should have come here
I have carefully read the documentation, but I still do not understand why the variable stubbornly refuses to change its value when orders are closed normally...:-))
 
KostelloArtua:

Hello!

Question: I wrote an EA that works on the tester. Works on MetaTrader4 at only one broker out of 2, just the one I don't need. And where I need it, it doesn't work..... What could be the problem?????? Thanks in advance....


Please provide here the text from the logbook of the terminal in which the EA does not work.

 
Fartowiy:

And the terminal works with the Exchange, not inside the office.


Forex is not an exchange.
 
zoritch:
I have carefully read the documentation, but I still do not understand why the variable stubbornly does not change its value when orders are closed normally...:-)))

I cannot say anything for now. The provided code is missing
 
PapaYozh:

Forex is not a stock market.

Sorry Colleagues !!! It's a little bit wrong, because I do not trade only in currencies. But the meaning is the same. Forgive me, but my commentary is related, help and advice to beginner,

 
zoritch:

kickup is an ordinary declared variable, int, which defaults to zero...:-))


You still need to understand what they want to see from you. read it again.
 
zoritch:

Gentlemen, please advise why the condition of passing the kickup profitability variable of a buy or sell order stubbornly fails to work...?

for(int l = total - 1; l >= 0; l--) {
OrderSelect(l, SELECT_BY_POS, MODE_TRADES);
if ((OrderSymbol() == Symbol()) && (OrderMagicNumber() == mn)) {

if (OrderType() == OP_BUY) {
if (OrderProfit() > 0) kickup = 2;
if (! OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid,Digits), 2, CLR_NONE)) {
trymore();

}
} else {
if (OrderProfit() > 0) kickup = 1;
if (! OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask,Digits), 2, CLR_NONE)) {
trymore();
}
}
}
}

I don't know the meaning of this construction of yours, I'm too lazy to guess, but try it this way:

   for (int l = total-1; l >=0; l--) {
      if (OrderSelect(l, SELECT_BY_POS)) {
         if (OrderSymbol() == Symbol() && OrderMagicNumber() == mn) {

            if (OrderType() == OP_BUY) {
               if (OrderProfit() > 0) kickup = 2;
               if (!OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid,Digits), 2, CLR_NONE)) 
                  trymore();
                  } 
            if (OrderType() == OP_SELL){
               if (OrderProfit() > 0) kickup = 1;
               if (!OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask,Digits), 2, CLR_NONE))
                  trymore();
               }
            }
         }
      }

 
artmedia70:

I don't know the point of this construction of yours, I'm too lazy to guess, but try it this way:


What's the difference?
 
Roger:

What's the difference?
I added one more condition to the loop and removed unnecessary brackets. You can do everything differently in general (it will be even better). Maybe a person initializes its variable each time after the loop, we can't see it anymore. Let's learn from telepaths...