How to determine the time of the current variable and the previous one. - futures io
futures io futures trading



How to determine the time of the current variable and the previous one.


Discussion in EasyLanguage Programming

Updated by Fobos
    1. trending_up 311 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 7 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

How to determine the time of the current variable and the previous one.

(login for full post details)
  #1 (permalink)
Ukraina
 
 
Posts: 15 since Aug 2010
Thanks: 5 given, 0 received

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.

 
Code
Inputs:
vTL(3), 
BuyTLColor (blue),
SellTLColor (red),
NetTLColor (white),
TLSize (1),
TLStyle (1);


Variables:
var0(0),
vTLValue(0),
BuyTL (1),
NetTL (1),
SellTL (1);


begin

var0 = Volume ;
var0 = Ticks ;

vTLValue = TL_GetEndVal(vTL);
If (close[0] > close[1] and var0 > vTLValue) then
BuyTL = TL_New_s(Date,Time_s, Low, Date, Time_s, High); 
TL_SetColor(BuyTL, BuyTLColor); 
TL_SetSize(BuyTL,TLSize); 
TL_SetStyle(BuyTL, TLStyle);

If (close[0] < close[1]and var0 > vTLValue) then
SellTL = TL_New_s(Date,Time_s, Low, Date, Time_s, High); 
TL_SetColor(SellTL, SellTLColor); 
TL_SetSize(SellTL,TLSize); 
TL_SetStyle(SellTL, SellTLColor);

If (close[0] = close[1]and var0 > vTLValue) then
NetTL = TL_New_s(Date,Time_s, Low, Date, Time_s, High); 
TL_SetColor(NetTL, NetTLColor); 
TL_SetSize(NetTL,TLSize); 
TL_SetStyle(NetTL, NetTLColor);


End;

Reply With Quote

Can you help answer these questions
from other members on futures io?
Scan by comparing SMAs within 5 mins
ThinkOrSwim
Cumulative Bid/Ask Chart resets after 2Billion
MultiCharts
TOS Custom Implied Volatility Rank Watchlist/Scanner Column
ThinkOrSwim
TOS to NT8... Need help converting a simple indicator
NinjaTrader
ZigZagHighLow of ThinkSwim to EasyLanguage of TradeStation
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
182 thanks
Micro account vs Funded account (combine)
53 thanks
Are sharks watching on the other side?
30 thanks
Spoo-nalysis ES e-mini futures S&P 500
24 thanks
Life sacrifice loneliness trading futures
20 thanks
 
(login for full post details)
  #2 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,187 since Apr 2013
Thanks: 384 given, 1,423 received

Fobos,

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.

Regards,

ABCTG

Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #3 (permalink)
Ukraina
 
 
Posts: 15 since Aug 2010
Thanks: 5 given, 0 received



ABCTG View Post
Fobos,

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.

Regards,

ABCTG

Tell me how to save DateTime into a variable?

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,187 since Apr 2013
Thanks: 384 given, 1,423 received

Fobos,

these two links should get you going:
DateTime Class
BarDateTime (Reserved Word)

Regards,

ABCTG


Fobos View Post
Tell me how to save DateTime into a variable?


Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #5 (permalink)
Ukraina
 
 
Posts: 15 since Aug 2010
Thanks: 5 given, 0 received


ABCTG View Post
Fobos,

these two links should get you going:
DateTime Class
BarDateTime (Reserved Word)

Regards,

ABCTG

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?

 
Code
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);
   
        
    end;



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);

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Hamburg Germany
 
Experience: Advanced
Platform: Multicharts, Tradestation
Broker: DTN IQ
Trading: ES
 
Posts: 2,187 since Apr 2013
Thanks: 384 given, 1,423 received

Fobos,

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


Fobos View Post
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?

 
Code
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);
   
        
    end;



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);


Follow me on Twitter Visit my Facebook Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #7 (permalink)
Ukraina
 
 
Posts: 15 since Aug 2010
Thanks: 5 given, 0 received


ABCTG View Post
Fobos,

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


 
Code
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;

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Ukraina
 
 
Posts: 15 since Aug 2010
Thanks: 5 given, 0 received

ABCTG, Thank you! Understood the code, fixed it.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > How to determine the time of the current variable and the previous one.


October 4, 2019


Upcoming Webinars and Events
 

Relative Rotation Graphs w/Julius de Kempenaer

Elite only
 

Every journal equals ten meals for the hungry

Now
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts