Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1088

 

Help please )

I built a line and got the time as shown in it , i closed the terminal and opened it and tried to get the time of the line but it was zero(((( how can i get it without re-building the line? ps Isn't it supposed to be saved?

string level_pos_buy = "level_pos_buy";
   
   if (ObjectCreate(0,level_pos_buy,OBJ_HLINE,0,Time[1],Close[1])) // создание горизонтального уровня
   {
      ObjectSet(level_pos_buy,OBJPROP_COLOR,DarkGreen);                 
      ObjectSetInteger(0,level_pos_buy,OBJPROP_STYLE,3);                
   }
         
   datetime enter_time  = (datetime)ObjectGetInteger(0,level_pos_buy,OBJPROP_TIME); // позиция время                     
   
   Print("       ", enter_time);   
 
Money_Maker: I draw a line, get the time, close the terminal, open it... Shouldn't the time value ..... be saved?
The horizontal line contains only one coordinate - the price. The time, which was plotted in the line, will be reset after restarting the terminal!
 

Hello, experts.

What function can I use to change the symbol on the chart?

Suppose I currently have a EURUSD chart and I want to switch it to GBPUSD

If it's not one function, maybe someone can show me an example.

 
I found one, but it opens an empty chart, how do I move all the indicators and close the former. Or am I on the wrong side?
ChartOpen("EURUSD",Period());
 

Good evening, when running the script there is an error in the logs: uninit reason 0

here is the code:


#property copyright "Copyright 2016, MetaQuotes Software Corp.

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

//+------------------------------------------------------------------+

//| Script program start function |

//+------------------------------------------------------------------+

void OnStart()

{

ObjectCreate(ChartID(), "HLine",OBJ_HLINE,0,0,iHigh(NULL,PERIOD_W1,0));

//--- set colour of the line

ObjectSetInteger(ChartID(), "HLine",OBJPROP_COLOR,Red);

//--- set the style of the line

ObjectSetInteger(ChartID(), "HLine",OBJPROP_STYLE,0);

//--- set the line thickness

ObjectSetInteger(ChartID(), "HLine",OBJPROP_WIDTH,1);

//--- display it on the foreground (false) or background (true)

ObjectSetInteger(ChartID(), "HLine",OBJPROP_BACK,true);

ObjectCreate(ChartID(), "LLine",OBJ_HLINE,0,0,iLow(NULL,PERIOD_W1,0);

//--- set colour of the line

ObjectSetInteger(ChartID(), "LLine",OBJPROP_COLOR,Blue);

//--- set the style of the line

ObjectSetInteger(ChartID(), "LLine",OBJPROP_STYLE,0);

//--- set the line thickness

ObjectSetInteger(ChartID(), "LLine",OBJPROP_WIDTH,1);

//--- display it on the foreground (false) or background (true)

ObjectSetInteger(ChartID(), "LLine",OBJPROP_BACK,true);

}

Can you please tell me what's wrong?

 
gince:

Hello, experts.

What function can I use to change the symbol on the chart?

Suppose I currently have a EURUSD chart and I want to switch it to GBPUSD

If it's not one function, maybe someone can show me an example.

ChartSetSymbolPeriod
 
LRA:
The horizontal line contains a single coordinate, the price. The time stamped in the line will be reset after restarting the terminal!
Thank you) I wish I could save the time(
 
Money_Maker:
Thank you) It's a pity you can't save time(
Draw a trendline, it saves both time and price for the start and end points.
 
evillive:
Draw a trend line that stores both time and price for the start and end points.
Thanks) I will do it that way, it may be the most convenient option
 

Another question is how to cut off extra zeros?

double a = 0.20000;

to get 0,2
ps the number of digits after the decimal point will always be used differently