Can you be a little more specific about what does and doesn't work ?
RaptorUK:
Can you be a little more specific about what does and doesn't work ?
Can you be a little more specific about what does and doesn't work ?
It puts the high and low line in the same place for UK100 but everything else it works fine.
full code:
//+------------------------------------------------------------------+ //| ATR box.mq4 | //| Copyright © 2011, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window int period_no = 10080; //daily //weekly = 10080 //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { if (Period() == PERIOD_H1) {period_no = 1440;} double hprice=iLow(Symbol(),period_no,0)+iATR(Symbol(),period_no,14,0); ObjectCreate("highLine",OBJ_HLINE,0,0,hprice); ObjectSet("highLine",OBJPROP_PRICE1,hprice); ObjectSet("highLine",OBJPROP_COLOR,Black); ObjectSet("highLine",OBJPROP_WIDTH,3); if (Bid >= hprice && GlobalVariableGet(Symbol()+"ATRbox") < iTime(NULL,0,0) ) { Alert(Symbol()+" possible ATR trade"); GlobalVariableSet(Symbol()+"ATRbox", iTime(NULL,0,0)); } double lprice=iHigh(Symbol(),period_no,0)-iATR(Symbol(),period_no,14,0); ObjectCreate("lowLine",OBJ_HLINE,0,0,lprice); ObjectSet("lowLine",OBJPROP_PRICE1,lprice); ObjectSet("lowLine",OBJPROP_COLOR,Black); ObjectSet("lowLine",OBJPROP_WIDTH,3); if (Bid <= lprice && GlobalVariableGet(Symbol()+"ATRbox") < iTime(NULL,0,0) ) { Alert(Symbol()+" possible ATR trade"); GlobalVariableSet(Symbol()+"ATRbox", iTime(NULL,0,0)); } return(0); } //+------------------------------------------------------------------+
Are you sure you have 14 D1 bars for UK100 ? have you had a look on a UK100 D1 chart?
ouble hprice=iLow(Symbol(),period_no,0)+iATR(Symbol(),period_no,14,0);Are you running in the tester, you can not get bar zero data in the tester for other pairs/TFs
RaptorUK:
Are you sure you have 14 D1 bars for UK100 ? have you had a look on a UK100 D1 chart?
Are you sure you have 14 D1 bars for UK100 ? have you had a look on a UK100 D1 chart?
yep, the weekly data goes back far as well.
I am trying to surround the Daily chart with a weekly ATR box (the lines).
SanMiguel:
OK, my UK100 data is futures type data so only goes back 6 weeks . .
yep, the weekly data goes back far as well.
I am trying to surround the Daily chart with a weekly ATR box (the lines).
Your code works on my chart.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
This code works for FX symbols but not index symbols like the UK100.
Any ideas what is wrong?