Download MetaTrader 5

ObectCreate() function sub window parameter?

To add comments, please log in or register
Stephen Reynolds
Stephen Reynolds  

In the code below I'm trying to draw a simple object on a sub window :

// Input variables 
input int KPeriod = 14;
input int DPeriod = 3;
input int Slowing = 3;
input ENUM_MA_METHOD StochMethod = MODE_SMA;

// OnTick() event handler                
void OnInit() 
   double stoch=iStochastic(_Symbol,_Period,KPeriod,DPeriod,Slowing,StochMethod,StochPrice,MODE_MAIN,0);
   datetime time=iTime(NULL,0,0);

   bool line1=ObjectCreate("Thumb",OBJ_ARROW_THUMB_UP,0,time,stoch);

Why cant I get the ObjectCreate() function to put an object on sub window? I've put 1 on 3rd parameter as required but it still doesn't draw any object?
When I place 0 it does draw the object okay on the main chart but why not stochastic?

Here I'm confused? I'm beginning to think ObjectCreate () can only draw objects on main window?

To add comments, please log in or register