In addition to the news, large bank transactions cause spikes in currencys. It is my uderstanding that many of these banks ( according to a friend at B of A ) make weekly transfers at a regulary scheduled time. What I am trying to do is identify these times before they happen and adjust my EA accordingally.
I figured that consistant spikes in price and volume would be a good way to identify these transactions ( or anything else that happens on a weekly basis and causes currencies to spike ). Here is my attempt to identify these times. Volume works but I cant seem to populate the Average_Hourly_Range variable.
Please take a look and tell me what I did wrong.
I figured that consistant spikes in price and volume would be a good way to identify these transactions ( or anything else that happens on a weekly basis and causes currencies to spike ). Here is my attempt to identify these times. Volume works but I cant seem to populate the Average_Hourly_Range variable.
Please take a look and tell me what I did wrong.
PHP Code
//========================================================================================= void HistoricVolitility(){ int WeekInSeconds = 604800; int HalfhourInSeconds = 1800; // Same Hour, Last Week datetime One_Week_Start = TimeCurrent() - WeekInSeconds - HalfhourInSeconds;//current time -1 week - Half hour datetime One_Week_Curr = TimeCurrent() - WeekInSeconds;//current time -1 week datetime One_Week_End = TimeCurrent() - WeekInSeconds + HalfhourInSeconds;//current time 1 week + Half hour int One_Week_Start_Per = iBarShift(Symbol(),0,One_Week_Start); int One_Week_Curr_Per = iBarShift(Symbol(),0,One_Week_Curr); int One_Week_End_Per = iBarShift(Symbol(),0,One_Week_End); double OneW_High = High[iHighest(Symbol(),0,MODE_HIGH,One_Week_End - One_Week_Start,One_Week_Start)]; double OneW_Low = Low[iLowest(Symbol(),0,MODE_LOW,One_Week_End - One_Week_Start,One_Week_Start)]; double OneW_Range = OneW_High - OneW_Low; double One_Week_Volume = iVolume(Symbol(),30,One_Week_Curr_Per+1); // Same Hour, 2 Weeks Ago datetime Two_Week_Start = TimeCurrent() - WeekInSeconds*2 - HalfhourInSeconds;//current time -1 week - Half hour datetime Two_Week_Curr = TimeCurrent() - WeekInSeconds*2;//current time -1 week datetime Two_Week_End = TimeCurrent() - WeekInSeconds*2 + HalfhourInSeconds;//current time 1 week + Half hour int Two_Week_Start_Per = iBarShift(Symbol(),0,Two_Week_Start); int Two_Week_Curr_Per = iBarShift(Symbol(),0,Two_Week_Curr); int Two_Week_End_Per = iBarShift(Symbol(),0,Two_Week_End); double TwoW_High = High[iHighest(Symbol(),0,MODE_HIGH,Two_Week_End - Two_Week_Start,Two_Week_Start)]; double TwoW_Low = Low[iLowest(Symbol(),0,MODE_LOW,Two_Week_End - Two_Week_Start,Two_Week_Start)]; double TwoW_Range = TwoW_High - TwoW_Low; double Two_Week_Volume = iVolume(Symbol(),30,Two_Week_Curr_Per+1); // Same Hour, 3 Weeks Ago datetime Three_Week_Start = TimeCurrent() - WeekInSeconds*3 - HalfhourInSeconds;//current time -1 week - Half hour datetime Three_Week_Curr = TimeCurrent() - WeekInSeconds*3;//current time -1 week datetime Three_Week_End = TimeCurrent() - WeekInSeconds*3 + HalfhourInSeconds;//current time 1 week + Half hour int Three_Week_Start_Per = iBarShift(Symbol(),0,Three_Week_Start); int Three_Week_Curr_Per = iBarShift(Symbol(),0,Three_Week_Curr); int Three_Week_End_Per = iBarShift(Symbol(),0,Three_Week_End); double ThreeW_High = High[iHighest(Symbol(),0,MODE_HIGH,Three_Week_End - Three_Week_Start,Three_Week_Start)]; double ThreeW_Low = Low[iLowest(Symbol(),0,MODE_LOW,Three_Week_End - Three_Week_Start,Three_Week_Start)]; double ThreeW_Range = ThreeW_High - ThreeW_Low; double Three_Week_Volume = iVolume(Symbol(),30,Three_Week_Curr_Per+1); // Same Hour, 4 Weeks Ago datetime Four_Week_Start = TimeCurrent() - WeekInSeconds*4 - HalfhourInSeconds;//current time -1 week - Half hour datetime Four_Week_Curr = TimeCurrent() - WeekInSeconds*4;//current time -1 week datetime Four_Week_End = TimeCurrent() - WeekInSeconds*4 + HalfhourInSeconds;//current time 1 week + Half hour int Four_Week_Start_Per = iBarShift(Symbol(),0,Four_Week_Start); int Four_Week_Curr_Per = iBarShift(Symbol(),0,Four_Week_Curr); int Four_Week_End_Per = iBarShift(Symbol(),0,Four_Week_End); double FourW_High = High[iHighest(Symbol(),0,MODE_HIGH,Four_Week_End - Four_Week_Start,Four_Week_Start)]; double FourW_Low = Low[iLowest(Symbol(),0,MODE_LOW,Four_Week_End - Four_Week_Start,Four_Week_Start)]; double FourW_Range = FourW_High - FourW_Low; double Four_Week_Volume = iVolume(Symbol(),30,Four_Week_Curr_Per+1); double Ave_Hourly_Range = (OneW_Range + TwoW_Range + ThreeW_Range + FourW_Range); double Ave_Volume = (One_Week_Volume + Two_Week_Volume + Three_Week_Volume + Four_Week_Volume)/4; HistoricRange = Ave_Hourly_Range; HistoricVolume = Ave_Volume; }
Keep it simple stoopid....