Hedging losses or balance of trades/market
-
Good day to all.
I am working on a high frequency ea with multiple trades in both directions. I am trying to figure out how to balance the market with a hedge. The ea should read the total sell lots, vs the total buy lots and hedge the difference. So.... I have a bucket of sell trades (in lots) and a bucket of buy trades (in lots) and I have created a formula to find the difference by taking the sells minus the buys to find the difference in lots. But when testing this function, I manually enter 0.10 buy lots and 0.40 sell lots. The difference should be 0.30 lots and a hedge should open for that value. But when I test the system, the hedge opens at 0.60. I am trying to figure out how to find the difference in lots between buys and sells, and use that value as the size for the buy trade. The hedge is meant to make me flat in the market. so doesn't matter if the price goes up or down, I won't loose anymore pips. Does anyone understand what I want and know how to implement it? Here is what I have worked on so far. (P.S. this is one the buy hedge section of my code. I need to get through this hurdle before continuing.) https://fxdreema.com/shared/T8jUJQ9de -
I noticed that I had the "SellDiff" variable as both the input and the adjustment that's why the hedge was double. My bad I figured it out. Thanks anyway. I can't see how to delete this thread, but thanks anyways I figured it out
-
Hi! im russian sory for my slang...
Need chek open random lose position
and chek profitable position
open 10 position buy lots 0.01
open 1 position recovery lots 0.021 position have - 15 pips for curret price
recovery position have +11 pops lots 0.02 = 22 pips
+22>-15 = close and have profit
and use this startegy fo al losses lots
this really constroction? -
@pipsacoin Can you please open a specific tread for your question?
-
@l-andorrà
this is the answer of the branch creator... can help?
and this repit my theme earlier
where did you require the link -
@stantonhitz
I understand what you want.
You have simple mistake in condition.
You double the lots size here, delete it and keep it empty.
-
how to make lots closing in parts?
pls help
-
@varso Thanks... I figured it out and couldn't delete the thread. I'm loving how easy this platform is.
-
-
if by 0.05 sell 0.03 all lots open in 1.2000 price... eurusd
curret price 1.1000 needs close 0.02 by and 0.03 sell + have profit and open losses 0.03 by... its really? -
@pipsacoin I'm afraid I don't fully understand what you mean.
-
It’s realistic to move so that the order with the lot 0.05 is not closed immediately in whole and in parts ... first close 0.02 with the lot 0.04, then repeat ... and close the remaining 0.01 with the lot 0.02 ... so it’s clear ?
-
@pipsacoin The block that varso recommend you to use can anly close partially the closest to the specified percentage in it. If you need a different closing ratio you will need to create a calculating tree block to do that.
-
you can give example?
-
@pipsacoin What partial closes will you need exactly?
-
hare it with other people
shared/eOhZTeXL
when open 2 postition , open 1 recovery 0.02 lots for close one trade lots 0.01...
-
@pipsacoin Ok. This is how you open trades. Your initial lot size is 0.01. You cannot partially close that minimum volum unless you are working with spacial brokers. If I underatand you correctly, you will open more trades. Right? If so they will be 0.02. Right?
Is this second one the trade you want to partially close?
-
Im open 3 position bay 0.01 lots and random price... nedds close 1 position havent 0.01 lots and close next order for dont have big averege ... recovery lots 0.02 for 1 lots 0.01 ...
-
@pipsacoin Don't get me wrong but I don't fully understand, you sorry. I speak Catalan and Spanish if you prefer to choose any of them.
-
ask ... maybe someone can help
