Counting for RadarScreen - futures io
futures io futures trading



Counting for RadarScreen


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 2 posts (1 thanks)
    2. looks_two haonkered with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 SKTennis with 1 posts (0 thanks)
    1. trending_up 3,821 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 6 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,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
 

Counting for RadarScreen

(login for full post details)
  #1 (permalink)
Houston, Texas, United States
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
 
Posts: 25 since Jun 2013
Thanks: 10 given, 5 received

I am looking for some guidance on how to start a "count", positive or negative, based on when an indicator occurred and would like to be able to show this in radar screen. I am using the 50/200d ma crossover and would like to show how many days back this occurred for each of the symbols on the radar screen. For bullish crossovers looking to show on radarscreen "L1" if the crossover occurred today, "L2" if yesterday, etc. And then S1, S2, S3, etc for days back the bearish crossover occured. Would like to be able to do this for multiple indicators eventually, MACD, SMA, etc but cannot seem to find any good resources online to read about how to start "the" counting....

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Indicators for pair trading MES and M2K
Platforms and Indicators
ZigZag with Depth and Backstep
EasyLanguage Programming
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Selling Options on Futures?
109 thanks
Battlestations: Show us your trading desks!
108 thanks
Rank your Futures vs Stocks trading priority
55 thanks
Want your NinjaTrader indicator created, free?
27 thanks
Whats this confusion with margins?
21 thanks
 
(login for full post details)
  #3 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received


haonkered,

one idea would be to count the days the study is running and then store the day count when a cross happens. Based on this I created this simple indicator for you. With every new day you can calculate how many days back a cross occurred.
When you load this indicator make sure to load enough "additional data for accumulative calculations". As you are using a Moving Average with 200 bars length I would suggest to load something around 1000 bars to give the indicator the chance to produce a cross over.

Regards,
ABCTG

 
Code
Variables:
	HaveUpCross		(false),
	HaveDnCross 		(false),
	UpCrossPlot 		("-"),
	DnCrossPlot 		("-"),
	UpCrossValue 		(0),
	DnCrossValue		(0),
	UpCrossDay		(0),
	DnCrossDay 		(0),
	DayCounter 		(0),
	MA50			(0),
	MA200 			(0);

//count days
if Date <> Date[1] then
	DayCounter = DayCounter + 1;
		
MA50 = Average(Close, 50);
MA200 = Average(Close, 200);

//bullish cross
if MA50 crosses over MA200 then
begin  
	//store the day of the upcross
	UpCrossDay = DayCounter;
	HaveUpCross = true;
end;

//bearish cross
if MA50 crosses under MA200 then
begin 
	//store the day of the dncross
	DnCrossDay = DayCounter;
	HaveDnCross = true;
end; 

if HaveUpCross then
begin
	//calculate how many days back the up cross occured
	UpCrossValue = DayCounter - UpCrossDay;
	UpCrossPlot = NumToStr(UpCrossValue, 0) + "L";
end;	
if HaveDnCross then
begin
	//calculate how many days back the dn cross occured
	DnCrossValue = DayCounter - DnCrossDay;
	DnCrossPlot = NumToStr(DnCrossValue, 0) + "S";
end;	

Plot1(UpCrossPlot, "Up Cross");
Plot2(DnCrossPlot, "Dn Cross");

Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #4 (permalink)
Houston, Texas, United States
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
 
Posts: 25 since Jun 2013
Thanks: 10 given, 5 received

Thanks. Seems to be working well. I do have a question however...is there a way to count 01, 02, 03....10,11,12 so that when sorting in RadarScreen the crosses from 1 day ago are not followed by the crosses 11 days ago, and then the 2s and 21s, etc etc

Started this thread Reply With Quote
 
(login for full post details)
  #5 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

Great. Yes, this can be done by simply adding a 0 in those cases.
 
Code
Variables:
	HaveUpCross		(false),
	HaveDnCross 		(false),
	UpCrossPlot 		("-"),
	DnCrossPlot 		("-"),
	UpCrossValue 		(0),
	DnCrossValue		(0),
	UpCrossDay		(0),
	DnCrossDay 		(0),
	DayCounter 		(0),
	MA50			(0),
	MA200 			(0);

//count days
if Date <> Date[1] then
	DayCounter = DayCounter + 1;
		
MA50 = Average(Close, 50);
MA200 = Average(Close, 200);

//bullish cross
if MA50 crosses over MA200 then
begin  
	//store the day of the upcross
	UpCrossDay = DayCounter;
	HaveUpCross = true;
end;

//bearish cross
if MA50 crosses under MA200 then
begin 
	//store the day of the dncross
	DnCrossDay = DayCounter;
	HaveDnCross = true;
end; 

if HaveUpCross then
begin
	//calculate how many days back the up cross occured
	UpCrossValue = DayCounter - UpCrossDay;
	UpCrossPlot = NumToStr(UpCrossValue, 0) + "L";
	if StrLen(UpCrossPlot) <= 2 then
		UpCrossPlot = "0"+ UpCrossPlot;	
end;	
if HaveDnCross then
begin
	//calculate how many days back the dn cross occured
	DnCrossValue = DayCounter - DnCrossDay;
	DnCrossPlot = NumToStr(DnCrossValue, 0) + "S";
	if StrLen(DnCrossPlot) <= 2 then
		DnCrossPlot = "0"+ DnCrossPlot;	
end;	

Plot1(UpCrossPlot, "Up Cross");
Plot2(DnCrossPlot, "Dn Cross");
Regards,
ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #6 (permalink)
Hyannis, MA
 
Experience: Advanced
Platform: TradeStation
Trading: ES
 
Posts: 3 since Nov 2011
Thanks: 0 given, 2 received

Here is a very simple way to count the number of bars since any event occurred.

Here is an example for two events. The count number is preceded by a letter that you specify as an the Name input.

This uses "L" and "S".

---

Input:
Event1(Average(Close, 50) crosses over Average(Close, 200)), Name1("L"),
Event2(Average(Close, 50) crosses under Average(Close, 200)), Name2("S");

if Event1 then Value1 = 0 else Value1 = Value1 + 1;
if Event2 then Value2 = 0 else Value2 = Value2 + 1;

Plot1(Name1 + NumToStr(Value1,0), "E1");
Plot2(Name2 + NumToStr(Value2,0), "E2");
---

Simply enter the event you want to track as the Event input. Examples might include:

Average(Close, 50) crosses over Average(Close, 200)
RSI(Close, 14) > 50

Reply With Quote
The following user says Thank You to BobF for this post:
 
(login for full post details)
  #7 (permalink)
Fort Walton Beach, Florida
 
 
Posts: 4 since Feb 2014
Thanks: 0 given, 0 received

I think if you just remove the "L" and "S" and plot as a number then it will sort numerically. You already have column headers, I think, that identify the direction.

It is because it is a text sort that "L11" sorts before "L2".

Just a FYI...

Samuel

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Counting for RadarScreen


Last Updated on February 17, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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