void OnStart() { datetime time=TimeCurrent(); string name="arrow"+TimeToString(time); double value = Ask; int arrow_code=233; ObjectCreate(ChartID(),name,OBJ_ARROW,0,time,value); ObjectSetInteger(NULL,name,OBJPROP_ARROWCODE,arrow_code); Print(GetLastError()); } }
but the print is wrong
Not sure what you mean by "the print is wrong," but you may need to add this if you are getting an error code you aren't expecting.
Hello All, first post :)
I have an indicator that writes new arrows to a csv:
With manually drawn arrows it prints perfectly,
but when I use this script to draw:
the indicator prints a correct name(sparam) but an incorrect arrow_code(from previous manual arrow) :(
I don't know what causes this, can you see my mistake?
hi really i didn't understood what you need correctly but as i understood you want to print your arrow values... you should use this to call arrow price like this code:
double arr_price=ObjectGetDouble(0,"arrow",OBJPROP_PRICE,0); Print(arr_price);
hi really i didn't understood what you need correctly but as i understood you want to print your arrow values... you should use this to call arrow price like this code:
Hello Abdullah, thank you for your answear :) the problem is that the objectgetinteger works only for the arrows I draw manually - when I use a script to draw, it does not get the arrowcode from the chart (instead it gives arrowcode for the last arrow drew manually)
ah ok then try this counter to use it inside your code...
int obj_total=ObjectsTotal(0,-1,-1); string name; for(int i=obj_total; i>=0; i--) { name=ObjectName(0,i,-1,-1); if(ObjectGetInteger(0,name,OBJPROP_TYPE)==OBJ_ARROW) { //here you can put array and fill it with arrows codes... } }
ah ok then try this counter to use it inside your code...
or u can do that without array if you just want to print :
int obj_total=ObjectsTotal(0,-1,-1); string name; for(int i=obj_total; i>=0; i--) { name=ObjectName(0,i,-1,-1); if(ObjectGetInteger(0,name,OBJPROP_TYPE)==OBJ_ARROW) { int arrow_code=ObjectGetInteger(ChartID(),name,OBJPROP_ARROWCODE); Print(arrow_code); } }
or u can do that without array if you just want to print :
Your code has really helped a lot :) I see now where was the problem - the indi performed objectgetinteger before the script performed objectsetinteger :p thats why on the chart the arrow was correct, but not for the indi. I have to slow the indi a little then. Thank you very much!
you welcome >>>>
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have an indicator that writes new arrows to a csv:
With manually drawn arrows it prints perfectly,
but when I use this script to draw:
the indicator prints a correct name(sparam) but an incorrect arrow_code(from previous manual arrow) :(
I don't know what causes this, can you see my mistake?