[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 233

 
Thank you. I'll look into it.
 

Hello Dear MT4 Gurus.

Can you please tell me how to get around the situation when OrderSend returns -1, but the order opens?

 
ftrw:

Can you tell me how to get around the situation where OrderSend returns -1, but the order opens?

Try using this function - OpenPosition() function for online.
 
artmedia70:
For a position open at 1500, a take at 1570 would be fine (if you don't consider StopLoss), but for a position open at 1600, a take at 1570 would cause error 130 - wrong stops. After all, a Take cannot be lower than the opening price for a Buy. This is already a StopLoss.
For two positions you have defined your breakeven point, but for three-four-five?
You should first define the breakeven formula for unidirectional positions, and then you can create a logic.

I agree that we should make a StopTLoss on an order with a price of 1600

at the opening of the order the function starts:

ticketBuy = OpenPendingOrderBuy(0, iLots, Ask, slip, Bid, 0, 0, EAName + "-" + NumOfTradesBuy, MagicNumber, 0, Lime)
all other orders will have the same opening
 
Vinin:

When we set or change TakeProfit, it all depends on when we set or change it. It is calculated from the current price.

count between orders: ((Ask - OrderBuy2) - swop - ...) + ((Ask - OrderBuy1) - swop - ...) = Profit, we get the number of points that we can lose as they are on the plus side

((Ask - OrderBuy3) -/+ swop -/+ ...) + ((Ask - OrderBuy2) - swop - ...) + ((Ask - OrderBuy1) - swop - ...) = Profit

Ask = 1620; Ask = 1760; OrderBuy3 = 1700

((1620 - 1500) - 4 - 6) + ((1620 - 1600) - 4 - 6) = 120; for 3 or more we add ((1760 - 1700) - 4 - 6) + ((1760 - 1500) - 4 - 6) + ((1760 - 1600) - 4 - 6) = 450

LotOrderBuy1 = 0.01; LotsS = 0.01

LotOrderBuy2 = 0.02; LotsS = 0.03

LotOrderBuy3 = 0.03; LotsS = 0.06

Total Lot LotsS = LotOrderBuy1 + LotOrderBuy2 = 0.03; for 3 or more we add

And here we need to understand how many lots we need to pass, what would eat 120 points or the sum of the profit in money.

To get StopProfit

Ask - StopProfit * Point = LineTakeProfit for OrderBuy1 and LineStopLoss for OrderBuy2

LotsS = 0.06

That's how I see it.

 
Roman.:
Try using this function - OpenPosition() function for online.

Thank you very much. The idea is clear, I will try it.
 
trol222:

Can anyone clarify this point. Here is the link https://www.mql5.com/ru/code/8102. The script (Expert Advisor attached) . Why when you calculate anything in the same excel file (CSV) when you close it (of course writes where to save - I click in the same file (instead)) and when you reopen the terminal and the file all calculations disappear???

Well firstly it is CSV, not the best format for saving calculations, and secondly the script overwrites this file.
 
PapaYozh:



It's working!!!! =))))) really not as it should be, but I'm very pleased =))) my deepest gratitude =))))
 
belck:

count between orders: ((Ask - OrderBuy2) - swop - ...) + ((Ask - OrderBuy1) - swop - ...) = Profit, we get the number of points that we can lose as they are on the plus side

((Ask - OrderBuy3) -/+ swop -/+ ...) + ((Ask - OrderBuy2) - swop - ...) + ((Ask - OrderBuy1) - swop - ...) = Profit

Ask = 1620; Ask = 1760; OrderBuy3 = 1700

((1620 - 1500) - 4 - 6) + ((1620 - 1600) - 4 - 6) = 120; for 3 or more we add ((1760 - 1700) - 4 - 6) + ((1760 - 1500) - 4 - 6) + ((1760 - 1600) - 4 - 6) = 450

LotOrderBuy1 = 0.01; LotsS = 0.01

LotOrderBuy2 = 0.02; LotsS = 0.03

LotOrderBuy3 = 0.03; LotsS = 0.06

Total Lot LotsS = LotOrderBuy1 + LotOrderBuy2 = 0.03; for 3 or more we add

And here we need to understand how many lots we need to pass, what would eat 120 points or the sum of the profit in money.

To get StopProfit

Ask - StopProfit * Point = LineTakeProfit for OrderBuy1 and LineStopLoss for OrderBuy2

LotsS = 0.06

This is how I see it

I've seen the answer to your question once. I'll even find it now. Here:


How to calculate how many points (in points) price can go down in negative market conditions?


link formula: Lot=Money/(Stoplos*Tick)
Money - earned/lost
Stoplos - in broker points
Tick - MarketInfo(Symbol(), MODE_TICKVALUE)
From here, spin as you like:
Stoplos=Money / (Lot*Tick)
Money=Lot*Stoplos*Tick

If you want to check this one, you may use it as well:

Calculation of CUE level for a set of one instrument:

total lots = total position (SP)

value of tick = ST

SP profit = ST

The formula for calculation is quite simple:

KP = PSP / (ST * SP)

In which we find out the number of pips(KP) to the CU level relative to the current price(TP) of the symbol.

And by substituting KP into the formula CU = TC - KP * Point we get the CU price level.

Depending on the direction of the JV, you choose whether to add or subtract from the TC.
 

Terminal does not see history



240
vitali_yv 04.10.2011 09:47
Good day. I have two computers with Win 7. On one of them I have the terminal with quotes from 2007, everything is working fine but I have no connection to the server. I have ported this terminal to another computer completely - I have not connected to server, I have not made any manipulations - what is more, that terminal is started with 2-3 minutes, and history starts with 2011, HST files are read only. Please advise where to dig.