How to get in Amibroker (15 minutes bars) HHV or LLV at needed time i.g. 10.00. Then how to use that value to open LONG or SHORT position. Next - the position closes at required TARGET PROFIT or at END of the DAY.
How to get in Amibroker (15 minutes bars) HHV or LLV at needed time i.g. 10.00. Then how to use that value to open LONG or SHORT position. Next - the position closes at required TARGET PROFIT or at END of the DAY.
Try the following AFL. Set your chart to 15min timeframe if you want to see the results on 15-minute chart. This AFL works on any timeframe smaller than 1 hour.
-Anant
The AFL is below:
//*********************************
F = Param("Factor", 0.5, 0.1, 10, 0.1); //Fraction of opening hourly bar range
FH = FL = 0;
Buy = Sell = Short = Cover = 0; //Required for modification of AFL later
BuyBar = SellBar = 0; //Required for modification of AFL later
CurrTime = TimeNum();
CurrDate = DateNum();
// ********************** FIND DAY's HIGH AND LOW ***************************
FH = ValueWhen(T <= 100000, H, 1); //First Hour High, For dates prior to 04 Jan 2010 use T<= 110000
FL = ValueWhen(T <= 100000, L, 1); //First Hour Low, For dates prior to 04 Jan 2010 use T<= 110000
//FH = ValueWhen(T <= CutOffTime, H, 1); //First Hour High, For dates prior to 04 Jan 2010 use T<= 110000
//FL = ValueWhen(T <= CutOffTime, L, 1); //First Hour Low, For dates prior to 04 Jan 2010 use T<= 110000
// ************************* CALCULATE TARGETS AND STOP LOSS *********************
FR = FH - FL; //Range of First Hour Bar
LTgt = FH + F * FR; //Target for Long position
STgt = FL - F * FR; //Target for Short position
TimeFrameRestore();
// **************************** Convert all above Values to current time frame ***********************
Try the following AFL. Set your chart to 15min timeframe if you want to see the results on 15-minute chart. This AFL works on any timeframe smaller than 1 hour.
-Anant
Many thanks again.
One more favour. Why it works in one day only? How to expend it for all days?
The backtest does not work, why?
Try the following AFL. Set your chart to 15min timeframe if you want to see the results on 15-minute chart. This AFL works on any timeframe smaller than 1 hour.
-Anant
Many thanks again.
One more favour. Why it works in one day only? How to expend it for all days?
The backtest does not work, why?
Try the following AFL. Set your chart to 15min timeframe if you want to see the results on 15-minute chart. This AFL works on any timeframe smaller than 1 hour.
-Anant
Many thanks again.
One more favour. Why it works in one day only? How to expend it for all days?
The backtest does not work, why?
This is an incomplete work. I had made this AFL for a friend of mine who is also a member here. As he had tested the system manually he just wanted an AFL which shows the required values on trading day (the current day). So, I did not make it to show the levels for all days. As it is showing the values and lines only on the last day it is not possible to back test it. Of course, you can use 'Bar Replay' and see it appearing each day. But that is a time consuming excercise.