Get the date from text box as string

hi all
I do not get error but I do not get result

I have the date in text box that will be editable
with format yyyymmdd

n_LOCATION_PRICE = GP_EditNumber(1,0, 180,  160, 65, 30, colorBlue, colorYellow); // for CH

bi = BarIndex();
StartDate =_DT(StrExtract( NumToStr( n_LOCATION_PRICE ), 0 ));  // yyyy-mm-dd 
EndDate = LastValue(DateTime());
StartBI = Lookup( bi, _DT( NumToStr(StartDate))); 
EndBI = Lookup( bi, EndDate); 

thank you

Here is the Simple Version, Edit Text Box will appear @0,0 Location
Where you need to enter the date , a rectangle will be drawn from the date to the last date in the chart,
May be this will help you understand and start .

idEdit = 121;

GuiEdit(idEdit,0,0,75,25,notifyEditChange );

str_date = GuiGetText(121);

bi = BarIndex();
StartDate =_DT(str_date);  // yyyy-mm-dd 
EndDate = LastValue(DateTime());
StartBI = Lookup( bi, StartDate); 
EndBI = Lookup( bi, EndDate); 
GfxSetCoordsMode(1);

GfxRectangle(StartBI,H[StartBI],EndBI,Low[EndBI]);
1 Like

hi

bi = BarIndex();
barsbetween =  Lookup( bi, _DT( "2020-12-15 09:15:00" ), -1 ) - Lookup( bi, _DT( "2020-12-05 15:30:00" ), -1 );

how to read ( "2020-12-15 09:15:00" ) from text box

thank you

dear kaeswar
i get your idea

idEdit = 121;

GuiEdit(idEdit,0,0,75,25,notifyEditChange );

str_date = GuiGetText(121);

in your code you used ( GuiGetText ) in my code i used ( GuiGetValue )

thank you

Hi needhelp,

GuiGetText ---> Returns String
GuiGetValue ---> Returns Numeric Value
Based on you Requirement you can make use of it

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.