"but it fails to always place it at the right bar"
Does it do this on a new chart, first time you run it?
If no...
Does it do it on an existing chart, particularly after changing timeframe or changing some indicator setting?
If yes...
my guess is you are reusing ArrowNum but not deleting old arrows named with those numbers
Does it do this on a new chart, first time you run it?
If no...
Does it do it on an existing chart, particularly after changing timeframe or changing some indicator setting?
If yes...
my guess is you are reusing ArrowNum but not deleting old arrows named with those numbers
"but it fails to always place it at the right bar"
Does it do this on a new chart, first time you run it?
If no...
Does it do it on an existing chart, particularly after changing timeframe or changing some indicator setting?
If yes...
my guess is you are reusing ArrowNum but not deleting old arrows named with those numbers
Does it do this on a new chart, first time you run it?
If no...
Does it do it on an existing chart, particularly after changing timeframe or changing some indicator setting?
If yes...
my guess is you are reusing ArrowNum but not deleting old arrows named with those numbers
It always works fine initially on a new chart but then stops after awhile. I think you may be right - I included the following line and it seems to be behaving properly now. Many thanks!
while (ObjectFind("TradeArrow"+ArrowNum) > 0)
ArrowNum++;
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
ArrowNum++; if (!IsTesting()) { if (OrderType()==OP_BUY) { ObjectCreate("TradeArrow"+ArrowNum,OBJ_ARROW,0,Time[0],Bid); ObjectSet("TradeArrow"+ArrowNum,OBJPROP_ARROWCODE,1); ObjectSet("TradeArrow"+ArrowNum,OBJPROP_COLOR,Blue); } else if (OrderType()==OP_SELL) { ObjectCreate("TradeArrow"+ArrowNum,OBJ_ARROW,0,Time[0],Ask); ObjectSet("TradeArrow"+ArrowNum,OBJPROP_ARROWCODE,1); ObjectSet("TradeArrow"+ArrowNum,OBJPROP_COLOR,Red); } }