Moving from mql4 to mql5 but can’t even draw a rectangle,
tried:
ObjectCreate(0, “Rectangle”, OBJ_RECTANGLE, 0, time[0], 1, time[5], 2)
just to get going but nothing is showing.
What’s wrong?
Here’s the full code:
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
ObjectCreate(0, "Rectangle", OBJ_RECTANGLE, 0, time[0], 1, time[5], 2);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+