Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to determine the time of the current variable and the previous one.
Hello! Tell me how to determine the time of the current variable and the previous one. The indicator shows a bar that satisfies the conditions, you need to find the time value of the last bar that satisfies the indicator conditions and the time value of the previous bar that satisfies the indicator conditions.
Can you help answer these questions from other members on NexusFi?
you can store the time or DateTime in a variable when your conditions are met. At the same location within the code and before (!) you update this variable you store the value of that variable in another variable. In case you need to look back further than a few occurrences you might want to consider using a vector to store the previous values.
Thank you so much! With your help, I managed to find the DateTime variable. Now I am looking for a high-low between the two variables DateTime and DateTime [1], but this code displays the high-low bars of these variables. What's my mistake?
since the code is incomplete I could only guess, but I would suggest using the print reserved word or debugger to find out when you variables are reset and if this happens for example on every bar.
since the code is incomplete I could only guess, but I would suggest using the print reserved word or debugger to find out when you variables are reset and if this happens for example on every bar.
Regards,
ABCTG
Inputs:
vTL(3),
High_Color(Red),
Mid_Color(RGB(255, 128, 0)),
Low_Color(blue),
High_Line_Tickness(2),
Mid_Line_Tickness(1),
Low_Line_Tickness(2),
High_Line_Style(2),
Mid_Line_Style(3),
Low_Line_Style(2);
Variables:
Times(0),
var0(0),
vTLValue(0),
openRangeHigh(0),
openRangeLow(999999),
tlHigh(0),
tlLow(0),
tlMid(0);
begin
var0 = Volume ;
var0 = Ticks ;
vTLValue = TL_GetEndVal(vTL);
If ( var0 > vTLValue) then
Times = DateTime;
end;
if (dateTime > Times[1]) and (dateTime <= Times) then begin
// Reset variables
if (dateTime[1] = Times[1]) then begin
openRangeHigh = 0;
openRangeLow = 99999;
end;
openRangeHigh = MaxList(High, openRangeHigh);
openRangeLow = MinList(Low, openRangeLow);
tlHigh = openRangeHigh;
tlMid = (openRangeHigh + openRangeLow) * 0.50;
tlLow = openRangeLow;
// Draw the trendlines
value10 = TL_New_Dt(Times[1] , tlHigh, Times, tlHigh);
value11 = TL_New_Dt( Times[1], tlMid, Times, tlMid);
value12 = TL_New_Dt( Times[1], tlLow, Times, tlLow);
// Change colour of the lines
TL_SetColor(value10, High_Color);
Tl_SetColor(value11, Mid_Color);
TL_SetColor(value12, Low_Color);
// Change the style of the lines
TL_SetStyle(value10, High_Line_Style);
TL_SetStyle(value11, Mid_Line_Style);
TL_SetStyle(value12, Low_Line_Style);
end;