Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 188

 
Vitalie Postolache:

So the commission has nothing to do with price points. It is charged on the order, irrespective of the number of pips that the price passed during the lifetime of this order. Yes, we can convert it to points, but it will be a bit larger than the spread. So, I asked, what is the use of it? Perhaps, the Pipsatters with the targets less than the spread?
You may be right. If I transfer commission + swap(!) then it makes more sense, and if I'm in the market for a long time, the cost may be up to 25 points and if I don't add these points to trail or Breakeven, I will close in the end with a loss.
 
Vitaly Muzichenko:
You may be right. I transfer commission + swap(!), and then it makes a lot of sense, and if we are in the market for a long time, the cost can be up to 25pp, and if we don't add these points to trawl or breakeven, we end up closing in a negative position
As for swap, I completely agree, it changes with time, especially when the swap is positive and a large order is hanging for a week or two. And the commission does it increase with time? It seems to be a lump sum.
 
Vitalie Postolache:
I completely agree about the swap, it changes over time, especially nice when the swap is positive and a large order hangs around for a week or two. Does the commission grow over time? It seems to be a lump sum.
The commission is roughly up to 1pp and does not change over time, but it is still nice when it is taken into account when moving the Breakeven and Trailing stops, you do not need to add anything manually, the program will do everything).
 
Vitaly Muzichenko:
The commission is roughly up to 1pp and does not change over time, but it is still nice when it is taken into account when moving the Breakeven and Trawl stops, no need to add anything manually, the program will do everything)


There is something wrong in your code:

tv=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE);

(OrderCommission()/(tv*OrderLots()))*Point()

Maybe this is better?

double tv=SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE);
int comissionpoints=int(OrderCommission()/tv/OrderLots());
But if commission is less than 1, the code will return 0. Or points in double format to represent?
 
Vitalie Postolache:


There is something wrong with your code:

Would this be better?

It's not how it's better, it's how it's right. The code was pulled from a neighbouring thread, and it's probably correct)
 
Vitaly Muzichenko:
It's not the right way, it's the right way. I pulled the code from a nearby branch and it's probably correct)


Well, it seems more correct not to multiply by Point.

If the price for a 1-lot order moves by 1 pip, then its profit will be changed by: OnePipCharge = Tickvalue * 1Lot * 1Point. From here we derive the number of pips, if the amount in the base currency is known: Pips = Charge/Lots/Tickvalue.

Isn't it like that?

 

Back to my, by far, sore subject - EA modification specifically on ndd-accounts.

1. If there are already open orders on the pair and a new order is opened, then everything is modified immediately (averaging).

2. If there are no orders and a new order is opened, i.e. one order appears, it is not modified (though in the same brokerage company on a simple account everything is modified as it should be and for several months already). The order is modified the next time the terminal is opened. In the general logs there is nothing at all about it and in the MQL4 logs there is an error 130 (wrong stops), after an order has been opened.

3. Today I was watching - order was opened, one on the pair, but it was not modified, quotes for the pair were coming in (I supposed such a variant). Remembering the previous variants, I restarted the terminal, but the order has not been modified. When I ran the terminal in the morning (I have daily charts) the order was modified.

What can it be? My opinion. Maybe, we should directly set the required TP in the opening function? Well, the order opening should be done according to the rules of nd accounts and then the TP and SL should be set.

 
Youri Lazurenko:

Back to my, by far, sore subject - EA modification specifically on ndd-accounts.

1. If there are already open orders on the pair and a new order is opened, then everything is modified immediately (averaging).

2. If there are no orders and a new order is opened, i.e. one order appears, it is not modified (though in the same brokerage company on a simple account everything is modified as it should be and for several months already). The order is modified the next time the terminal is opened. In the general logs there is nothing at all about it and in the MQL4 logs there is an error 130 (wrong stops), after an order has been opened.

3. Today I was watching - order was opened, one on the pair, but it was not modified, quotes for the pair were coming in (I supposed such a variant). Remembering the previous variants, I restarted the terminal, but the order has not been modified. When I ran the terminal in the morning (I have daily charts) the order was modified.

What can it be? My opinion. Maybe, we should directly set the required TP in the opening function? Well, the rules of nd-accounts seem to be: first we open an order and then we set TP and SL.

Do you open a position with a non-zero TP and SL at once?

Try to first open a position with a stop and a take equal to zero, check that the position is open, and modify the stop and take to the required values.

 
Artyom Trishkin:

Do you open a position with a non-zero stop and take?

Try opening a position with a stop and take equal to zero first, check that the position is open and modify its stop and take to the right values.


That's how it works for me - open an order with zero TP and SL, and then modify (the order) with the right TP and SL parameters. I already wrote, everything works and worked fine on other accounts, only on ndd such a thing. Haven't worked with anyone else with similar accounts before, can't compare. Maybe it's only forex4u's bleeping, or maybe all ndd accounts. Would like to know for future reference.
 
Vitalie Postolache:


Well, it seems more correct not to multiply by Point.

If the price for a 1Lot order moves by 1 pip, its profit will change to: OnePipCharge = Tickvalue * 1Lot * 1Point. From here, derive the number of pips, if the amount in the base currency is known: Pips = Charge/Lots/Tickvalue.

Isn't it?

What is the difference

Pips = Charge/Lots/Tickvalue in specific numbers 8/2/4 = 1

or

Pips = Charge/(Lots*Tickvalue) in concrete terms 8/(2*4) = 8/8 = 1

Fractional numbers can also be used...

Reason: