| / | Articles |
Articles
Trading Systems
What about Hedging Daily?
To post a new article, please log in or register
|
What about Hedging Daily?IntroductionI am giving away an idea of hedging the GBP/JPY & EUR/JPY daily. Yes Daily. This idea popped up while I was trying to generate a trading system that plays on the daily scheme, opening the trade only once a day, collecting the profit only around $100 each day, and of course, all the things do automatically. At the first time, I only tried to trade with the TD-Sequential System, owned by Tom Demark. I tried trading it daily, actually it dose a good system, but somehow give me an unacceptable loss, then the idea of hedging the two correlated pairs came out. "Why don't hedge ?, then you will lose less than today or maybe you can gain, sounds grate ! ". Then i tested it manually with 1 month past history, and found a good profit maker sign. So...no need to wait for anything, just make it automatically trade for you and test it live for a couple of months or longer. Now let's start making it comes true. Concept of Daily HedgeBefore we start the coding process, let's make a plan together. Including...
-> Which hedging pairs to hedge? : Just select your favorite pairs. Mine are GBP/JPY and EUR/JPY, with the reason above. -> Which pair will be the base pair? & Which one will be the hedge pair? : This will make it easier to code the EA. I decided to mark the EUR/JPY as my base pair and hedge GBP/JPY. ("Why Base & Hedge?", that's because of the system is hedge by the daily trend.) For example, today the TD-Sequential signal out the UP trend of EUR/JPY, then I will BUY EUR/JPY and hedge by selling GBP/JPY. Or maybe you can make sure by mark the UP day only when both EUR/JPY and GBP/JPY are showing the TD-Sequential UP, then buy the base pair & sell the hedge pair.
-> What is the ... correlation ? : Of course, we need this factor, and you all know, it is an important factor of hedging system. In this case, I will only allow to hedge when the correlation of those two pairs is 0.9 or higher only. YES, please don't be astonished. Yes 0.9+ "WHY ?", I know every hedge professor suggests you to hedge when the correlation is low, but that is for a very very and very long - term . To me and my daily hedging system, hedging at high correlation is better. Please NOTE that, this is for my daily hedging system only. Because we need them to go the same way always, especially for today (our trading day), then we can get one positive and one negative always and then only collect the profit when they swing, even they were never swing in the profitable way, you still loss less than one way in negative trade. O.K. Now let's start coding. Daily Hedge Expert AdvisorIn this part, I will separate it into 5 major parts, that is .
And now let's begin with the input parameters. 1. Input Parameters//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~External Input Parameters~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// extern bool BlockOpening=false; extern bool ShowStatus=true; extern string Auto_Lot_______________________="_______"; // Always Calculate The Lot Size Automatically extern int PercentMaxRisk=25; // With Max Risk Of 25% by default extern string How_Much_You_Xpect?____________ ="_______"; // The Getting Profit Part extern double Daily_Percent_ROI=7.98; // How many daily %ROI you wish. extern double AcceptableLoss_ROI=3.08; // daily Acceptable loss calculated in ROI scheme. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Internal Input Parameters~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// string BaseSymbol="GBPJPY"; string H_Symbol="EURJPY"; int CorPeriod_1=3; // just for checking that short-term int CorPeriod_2=5; //& long-term Correlation are the same concederation level bool AutoLot=true; double H_B_LotsRatio=1.50; // always hedge those 2 pairs by 1:1.5 ratio int MMBase=3; string ExpectCorrelation______________= "______"; // the concederation level of their correlation. double Between=1.05; double And=0.9; string TDSequential="______"; // my easy TD-Sequential signal int cntFrom=1; // only refer the today signal by yesterday candle int cntTo=3; // count back to the 3rd candle bool ClearTradeDaily?=true; // always clear the yesterday hedge string MISC___________________________= "______"; int MagicNo=317; bool PlayAudio=false; int BSP ,HSP ,gsp ,BOP=-1 ,HOP=-1 ,up=0 ,Hcnt=0 ,u=0 ,d=0 ,day=0 ,sent=0 ,cntm ,curm ; double Lot ,BaseOpen ,HOpen ,BaseLots ,HLots ,BUM //Base Used Margin ,GBUM //Get BUM ,HUM //Hedge Used Margin ,GHUM //Get HUM ,TUM //Total Used Margin ,BPt ,HPt ,midpt3; bool SResult=false,BResult=false; bool allmeetcor=false,BlockOpen=false,cleared=false; string candletxt,tdstxt=""; double Min_Lot; double Max_Lot; double lot_step; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- BSP=MarketInfo(BaseSymbol,MODE_SPREAD); HSP=MarketInfo(H_Symbol,MODE_SPREAD); BPt=MarketInfo(BaseSymbol,MODE_POINT); HPt=MarketInfo(H_Symbol,MODE_POINT); lot_step=MarketInfo(BaseSymbol, MODE_LOTSTEP); Min_Lot=MarketInfo(BaseSymbol, MODE_MINLOT); if(Min_Lot<=0)Min_Lot=1*lot_step; Max_Lot=MarketInfo(BaseSymbol, MODE_MAXLOT); if(BSP>HSP)gsp=HSP; else gsp=BSP; //---- return(0); } 2. Daily Trend Signal Function |
![]() Layman's Notes: ZigZag…
Surely, a fey thought to trade closely to extremums visited every apprentice trader when he/she saw "enigmatic" polyline for the first time. It's so simple, indeed. Here is the maximum. And there is the minimum. A beautiful picture on the history. And what is in practice? A ray is drawn. It should seem, that is it, the peak! It is time to sell. And now we go down. But hell no! The price is treacherously moving upwards. Haw! It's a trifle, not an indicator. And you throw it out! |
![]() Expert Advisors Based on Popular Trading Systems and Alchemy of Trading Robot Optimization (Cont.)
In this article, the author gives an example Expert Advisor meeting the requirements stated in the Rules of the Automated Trading Championship 2008 |
| Previous | Next |
I don't think it's a perfect idea though the thought's sound good.
As the author said "I decided to mark the EUR/JPY as my base pair and hedge GBP/JPY",no matter you buy/sell EUR/JPY and sell/buy GBP/JPY, it's the same effect as you buy or sell EUR/GBR in fact.
how could we find out what exactly H317.csv and B317.csv are?
i didn't see the author mentioned it elsewhere.
The csv files record the used margin for each of the hedged pairs; the system will create the files.
BlockOpening=false allows orders to be placed, if true orders sending will be blocked.
Anyway, this EA is not useable as it is: errors in firing orders, acceptable loss is computed wrongly,
too many files opened error, and sometimes divide by zero error
how could we find out what exactly H317.csv and B317.csv are?
i didn't see the author mentioned it elsewhere.
don't u cry or yell.
this is not about versions of MT4, i guess. i guess that the author didn't post all files required by the EA.
reading thru the code, that's the only way to get it.
I just don't understand why the EA is made 1 yr ago but published now.
Where can we get the old version of MT4?
Thanks.
Hi,
I am running the EA on Alpari demo account since one week without any trades. Like many others I get the error 2008.08.27 08:29:28 DailyH: FileOpen - too many opened files.
Please advice
I have had this on forward test for a week now on IBFX demo and it has not placed a trade yet. I checked the logs and found what I believe to be an error but am not sure. Can any one explain these log entries and why it has not traded? There are simular entries on several different days.
15:05:00 Old tick EURJPYm1440 161.27000/161.31000
15:05:00 Old tick EURJPYm1440 161.28000/161.32001
It seems the author of tis EA is not visiting this Forum or he may be intentionally do not want to help us. I wish he places a note on this forum telling his intentions, so that others do not waste time on this EA.
I also appreciate if the moderator of this forum tell us all about the author and his intentions.
If the author of this EA is not responding at all, then, why not we ourselves try to heal each other?
(i) It takes about 5 minutes to go through the code and read all the comments he has made (Read only the comments and do not try to understand the code).
(ii) Identify waht each external input is for. What function those external inputs do?
(iii) Identify what each internal input is for. What function those internal inputs do?
This knowledge gives us an idea about how the EA functions.
Now, my own personal question to you all: What does the very first external input "BlockOpening = false" does?
I have had this on forward test for a week now on IBFX demo and it has not placed a trade yet. I checked the logs and found what I believe to be an error but am not sure. Can any one explain these log entries and why it has not traded? There are simular entries on several different days.
15:05:00 Old tick EURJPYm1440 161.27000/161.31000
15:05:00 Old tick EURJPYm1440 161.28000/161.32001
It seems the author of tis EA is not visiting this Forum or he may be intentionally do not want to help us. I wish he places a note on this forum telling his intentions, so that others do not waste time on this EA.
I also appreciate if the moderator of this forum tell us all about the author and his intentions.
Hai there,
you haven't respond to any of the questions raised here. Appreciate if u could answer all those Q.
Hi,
It seems the author of tis EA is not visiting this Forum or he may be intentionally do not want to help us. I wish he places a note on this forum telling his intentions, so that others do not waste time on this EA.
I also appreciate if the moderator of this forum tell us all about the author and his intentions.
I have had this on forward test for a week now on IBFX demo and it has not placed a trade yet. I checked the logs and found what I believe to be an error but am not sure. Can any one explain these log entries and why it has not traded? There are simular entries on several different days.
15:05:00 Old tick EURJPYm1440 161.27000/161.31000
15:05:00 Old tick EURJPYm1440 161.28000/161.32001