oops..script missingpalatine wrote:To steve, and trader/programmer interested about circular hedge
I have posted a script that I took from mql4 website to automatically execute a circular hedge after placing the first order in place but I am having problem to run to Empty4 (IC markets).
for example :
sell 0.5 EUR EURCHF
it will execute
buy 0.25 EURUSD
Buy 0.33 USDCHF
to do an impeccable hedge rounded because brokers can not do a lot size such as : 32748 USD![]()
I am not a programmer but this script can be usefull for trader who wish to limit their DD. It would be
Happy trading
JC
3 paires circular hedge
-
phil_trade
Re: 3 paires circular hedge
- aSushiRoll
- Trader
- Posts: 74
- Joined: Fri Apr 05, 2013 10:54 pm
Re: 3 paires circular hedge
Script is still missing,
how is it working out for you?
-
phil_trade
Re: 3 paires circular hedge
not tested, but :phil_trade wrote:oops..script missingpalatine wrote:To steve, and trader/programmer interested about circular hedge
I have posted a script that I took from mql4 website to automatically execute a circular hedge after placing the first order in place but I am having problem to run to Empty4 (IC markets).
for example :
sell 0.5 EUR EURCHF
it will execute
buy 0.25 EURUSD
Buy 0.33 USDCHF
to do an impeccable hedge rounded because brokers can not do a lot size such as : 32748 USD![]()
I am not a programmer but this script can be usefull for trader who wish to limit their DD. It would be
Happy trading
JC
you just have to change ",2" by ",1" for this 2 lines of codes of "Hedge_This" function :
Code: Select all
double Size_1 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[b],MODE_TICKVALUE),2);
double Size_2 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[c],MODE_TICKVALUE),2);Code: Select all
double Size_1 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[b],MODE_TICKVALUE),1);
double Size_2 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[c],MODE_TICKVALUE),1);Code: Select all
void Hedge_This(string HedgeSymbol, int HedgeType, double HedgeLots){
int a,b,c;
double TranCost = 99999999;
string SynSymbol_1,SynSymbol_2;
int Direction_1,Direction_2;
double Lots_1,Lots_2;
for (a = 0; a < ArraySize(Indexes); a++){
if(Indexes[a] == StringSubstr(HedgeSymbol,0,3) || Indexes[a] == StringSubstr(HedgeSymbol,3,3)){ continue; }// skip useless indexes
for (b = 0; b < ArraySize(Pairs); b++){
if (HedgeSymbol == Pairs[b]){ continue; }// Skip = values
for (c = 0; c < ArraySize(Pairs); c++){
if( HedgeSymbol == Pairs[c]){ continue; }// Skip = values
double Size_1 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[b],MODE_TICKVALUE),2);
double Size_2 = NormalizeDouble((MarketInfo(HedgeSymbol,MODE_TICKVALUE) * HedgeLots) / MarketInfo(Pairs[c],MODE_TICKVALUE),2);- mobthehop
- Trader
- Posts: 362
- Joined: Wed Nov 16, 2011 12:16 am
Re: 3 paires circular hedge
not sure what happened here as palatine is gone but Phil would you pls be so kind to post the complete code is I really would like to have a look how this is coded...
Cheers / Mop
Cheers / Mop
-
phil_trade
Re: 3 paires circular hedge
Hi Mopmobthehop wrote:not sure what happened here as palatine is gone but Phil would you pls be so kind to post the complete code is I really would like to have a look how this is coded...
Cheers / Mop
I don't know what's happened
Please email Palatine
Philippe
- kwanann
- Trader
- Posts: 948
- Joined: Thu Nov 29, 2012 1:53 am
Re: 3 paires circular hedge
I've been trading using OM Dual N EA for the past 2 years, live results can be found over at https://www.fxblue.com/users/kwanann
-
palatine
- Posts: 3
- Joined: Fri Aug 09, 2013 1:34 pm
Re: 3 paires circular hedge
Hi traders,
I am back. Any , I was taking the making the change precognized by phil. but still not working. I wish to see someone could see the code to fix it and remove the silly message from this code.
I would love to use this script to see this kind of hedging would softer the DD when taking risk
I agree to smaller profit with a smaller risk.
regards to all and thank to steve to help me to be back
Jean charles
I am back. Any , I was taking the making the change precognized by phil. but still not working. I wish to see someone could see the code to fix it and remove the silly message from this code.
I would love to use this script to see this kind of hedging would softer the DD when taking risk
I agree to smaller profit with a smaller risk.
regards to all and thank to steve to help me to be back
Jean charles
You do not have the required permissions to view the files attached to this post.
-
palatine
- Posts: 3
- Joined: Fri Aug 09, 2013 1:34 pm
Re: 3 paires circular hedge
palatine wrote:Hi traders,
I am back. Any , I was taking the making the change precognized by phil. but still not working. I wish to see someone could see the code to fix it and remove the silly message from this code.
I would love to use this script to see this kind of hedging would softer the DD when taking risk![]()
I agree to smaller profit with a smaller risk.
regards to all and thank to steve to help me to be back
Jean charles
Dear,
I was trying what told me to do , but I ad no sucess into it.
Is there any body can help me please ?
Regards,
Jc
- fxdaytrader
- Trader
- Posts: 190
- Joined: Sun Jun 10, 2012 7:03 am
- Location: Poon-Town (germany, se-asia, se-europe) ...
Re: 3 paires circular hedge
What is the problem - to compute the correct amount of lots for the hedgepair?
if yes: I made an example, put this in an indicator, this calculation should work:
this function also:
if yes: I made an example, put this in an indicator, this calculation should work:
Code: Select all
string Pair = "EURUSDm"; //example, add suffix also
string Hedge = "EURJPYm"; // -''-
double lots = 0.77;
double amountPair = lots*tickValueReliable(Pair);
double amountHedge = lots*tickValueReliable(Hedge);
double lotmult=amountPair/amountHedge;
double newLots = lots * lotmult;
double newAmountHedge = newLots*tickValueReliable(Hedge);
Comment("to hedge "+Pair+" (amount: "+DoubleToStr(amountPair,2)+") -> lots "+DoubleToStr(lots,2)+" you have to send an order "+Hedge+" (amount old: "+DoubleToStr(amountHedge,2)+") -> lots "+DoubleToStr(newLots,2)+" (NEW amount: "+DoubleToStr(newAmountHedge,2)+")");Code: Select all
double tickValueReliable(string symbol) {
double tval=MarketInfo(symbol,MODE_TICKVALUE) * MarketInfo(symbol,MODE_POINT) / MarketInfo(symbol,MODE_TICKSIZE);
return(tval);
}-
palatine
- Posts: 3
- Joined: Fri Aug 09, 2013 1:34 pm
Re: 3 paires circular hedge
Hello fx day trader,fxdaytrader wrote:What is the problem - to compute the correct amount of lots for the hedgepair?
if yes: I made an example, put this in an indicator, this calculation should work:
this function also:Code: Select all
string Pair = "EURUSDm"; //example, add suffix also string Hedge = "EURJPYm"; // -''- double lots = 0.77; double amountPair = lots*tickValueReliable(Pair); double amountHedge = lots*tickValueReliable(Hedge); double lotmult=amountPair/amountHedge; double newLots = lots * lotmult; double newAmountHedge = newLots*tickValueReliable(Hedge); Comment("to hedge "+Pair+" (amount: "+DoubleToStr(amountPair,2)+") -> lots "+DoubleToStr(lots,2)+" you have to send an order "+Hedge+" (amount old: "+DoubleToStr(amountHedge,2)+") -> lots "+DoubleToStr(newLots,2)+" (NEW amount: "+DoubleToStr(newAmountHedge,2)+")");Code: Select all
double tickValueReliable(string symbol) { double tval=MarketInfo(symbol,MODE_TICKVALUE) * MarketInfo(symbol,MODE_POINT) / MarketInfo(symbol,MODE_TICKSIZE); return(tval); }
It is not the amount of lot but just the execution of the script when you try to apply to a position to cover. And I was looking over the suggestion previously submitted but no change in execution of the script.
It also help movement of over other pair like triangulation a radio signal.
(I passed over the silly message that the script open while the execution )
Regards,
JC