I got a Problem with Chart
Shift functions. Problem: Call Chart_Shift but the Chart is not shifted right away? :)
I noticed the ChartShift icon is changed right away after i hit "H" key but the CHart is not??? ... Im new to coding,
Please help! ... & have a good day all :D
here is my code:
//+------------------------------------------------------------------+//| update chart shift.mq4 |#property strict#property indicator_chart_windowexternint ChartShift = 25;
inputstring H="H";
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- indicator buffers mapping//---return(INIT_SUCCEEDED);
}
// voidOnChartEvent(constint id,constlong& lparam,constdouble& dparam,conststring& sparam)
{
//if(id == CHARTEVENT_KEYDOWN)
{
if (lparam == StringGetChar(H,0)) updateCHARTSHIFT();
}
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//---//--- return value of prev_calculated for next callreturn(rates_total);
}
//+------------------------------------------------------------------+void updateCHARTSHIFT()
{
double result = ChartShiftSizeGet();
Print("ChartShiftSizeGet() = "+string(result));
//if (result != ChartShift)
{
ChartShiftSizeSet(ChartShift);
Print("ChartShiftSizeSet() = "+string(ChartShift));
}
//bool isShifted = ChartGetInteger(0,CHART_SHIFT,true);
Print("isShifted = "+string(isShifted));
if (!isShifted) ChartSetInteger(0,CHART_SHIFT,true);
ChartRedraw(0);
;
}
//double ChartShiftSizeGet(constlong chart_ID=0)
{
//--- prepare the variable to get the result double result=EMPTY_VALUE;
//--- reset the error value ResetLastError();
//--- receive the property value if(!ChartGetDouble(chart_ID,CHART_SHIFT_SIZE,0,result))
{
//--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError());
}
//--- return the value of the chart property return(result);
}
//bool ChartShiftSizeSet(constdouble value,constlong chart_ID=0)
{
//--- reset the error value ResetLastError();
//--- set property value if(!ChartSetDouble(chart_ID,CHART_SHIFT_SIZE,value))
{
//--- display the error message in Experts journal Print(__FUNCTION__+", Error Code = ",GetLastError());
return(false);
}
//--- successful execution return(true);
}
Hello pro Coders,
I got a Problem with Chart Shift functions. Problem: Call Chart_Shift but the Chart is not shifted right away? :)
I noticed the ChartShift icon is changed right away after i hit "H" key but the CHart is not???
... Im new to coding, Please help! ... & have a good day all :D
here is my code: