Scanning for indicator changes across 2 bars - futures io
futures io



Scanning for indicator changes across 2 bars


Discussion in TradeStation

Updated
    1. trending_up 1,847 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 16 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
 

Scanning for indicator changes across 2 bars

(login for full post details)
  #1 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
 
Posts: 10 since Apr 2014
Thanks: 4 given, 2 received

Hello,

Noob here. Trying to figure out how to do the following. I want to scan for stocks that meet the following criteria:

Previous Bar: DMI (-) is greater than DMI (+)
Current Bar: DMI (+) is greater than DMI (-) and DMI (+) is greater than a value such as 25.

I have not had any luck figuring out how to make TradeStationís scanner look back to previous bars. Is this even possible via Scanner? Is it possible using a custom indicator?

I don't know EL. Any help is greatly appreciated.

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Coding first profitable weekly open
Elite EasyLanguage Algorithmic Trading
how to avoid these type of trades in algo
NinjaTrader
Anchored VWAP on different timeframes
Platforms and Indicators
Store value in variable when emas crossover easy language
EasyLanguage Programming
Hello, Im new, trying to learn the footprint
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Spoo-nalysis ES e-mini futures S&P 500
75 thanks
Any long term success stories from funded traders in the …
46 thanks
How to work on strategy
26 thanks
How to avoid wiping out the accounts?
18 thanks
Why dont people trade 150 ES contracts?
17 thanks
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

Hi 10handles,

I couldn't find right away how to reference the previous bar in the scanner, maybe someone else knows. However you can use this custom indicator I created for you to do the testing. When your scan conditions are met it will return +1 and 0 if not. So you need to display those symbols that return 1 in the scanner.

You can reference previous bar's values with brackets and the number within the brackets is how many bars back you want to go back from the current bar. So oDMIPlus[1] in the code below would be the value for DMI(+) from the previous bar.

Have a great weekend.

Regards,
ABCTG

 
Code
inputs: 
	Length( 14 ), 
	ADXTrend( 25 ) ,
	UpperThreshold( 25 );

variables: 
	vResult( 0 ),
	oDMIPlus( 0 ), 
	oDMIMinus( 0 ), 
	oDMI( 0 ), 
	oADX( 0 ), 
	oADXR( 0 ), 
	oVolty( 0 ) ;

Value1 = DirMovement( H, L, C, Length, oDMIPlus, oDMIMinus, oDMI, oADX, oADXR, 
 oVolty ) ;

{check conditions 
Previous Bar: DMI (-) is greater than DMI (+)
Current Bar: DMI (+) is greater than DMI (-) and DMI (+) is greater than a value such as 25.}
if oDMIMinus[1] > oDMIPlus[1] and oDMIPlus > oDMIMinus and oDMIPlus > UpperThreshold then
	vResult = + 1
else
	vResult = 0 ;	

Plot1( vResult, "Result" ) ;

Follow me on Twitter Reply With Quote
The following 4 users say Thank You to ABCTG for this post:
 
(login for full post details)
  #3 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
 
Posts: 10 since Apr 2014
Thanks: 4 given, 2 received


ABCTG,

Thank you so very much. I had some problems at first but I identified the issue and it is now working.

Much obliged for your help!!

Started this thread Reply With Quote
The following user says Thank You to 10handles for this post:
 
(login for full post details)
  #4 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

10handles,

you are welcome. How did you overcome the issues you have been facing?

Regards,
ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #5 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
 
Posts: 10 since Apr 2014
Thanks: 4 given, 2 received

Hello ABCTG,

The first thing I did was remove the ADXTrend and UpperThreshold inputs, and replaced UpperThreshold in the conditions area with the value 25. Although I don't really know if this had much, if any, effect.

What seemed to have the most effect was in the Scanner, changing the "Load Additional Data" value from 1 to 300. As soon as I did that, I was starting to see some "1s". I didn't bother to go back and change the code to the original code...at least not yet.

Thanks again.

Started this thread Reply With Quote
The following user says Thank You to 10handles for this post:
 
(login for full post details)
  #6 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

10handles,

thanks for the feedback. Loading Additional Data is what did the trick. The reason is that the indicator needs a certain amount of data to properly calculate. If you load less than the needed amount Tradestation will not plot anything.
In the case of the ADX at least an amount equal to the Length input is needed to give a result.

Regards,
ABCTG


10handles View Post
What seemed to have the most effect was in the Scanner, changing the "Load Additional Data" value from 1 to 300. As soon as I did that, I was starting to see some "1s". I didn't bother to go back and change the code to the original code...at least not yet.


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #7 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
 
Posts: 10 since Apr 2014
Thanks: 4 given, 2 received

Hello again,

I've been trying to adapt your code to work with other indicators but I am not having any luck.

What I'd like to do is scan for the MoneyFlow indicator turning down (or up). If I can get this working for one indicator such as MoneyFlow then I imagine it would not be too difficult to adapt the code to work for other indicators as well. Was hoping to piggy back off the DMI indicator code but that hasn't worked. Is this something you might be able to help me with? Thanks in advance.

Started this thread Reply With Quote
 
(login for full post details)
  #8 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

10handles,

if you post your code modifications you are having trouble with, I will take a look at it and try to steer you into the right direction.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #9 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
 
Posts: 10 since Apr 2014
Thanks: 4 given, 2 received

Thanks. Here is what I have and I'm sure it is way off. I don't know EL.

inputs:
Length( 14 );

variables:
vResult( 0 ),
oMoneyFlow( 0 ) ;

Value1 = DirMovement( C, Length, oMoneyFlow ) ;

if oMoneyFlow < oMoneyFlow then
vResult = +1
else
vResult = 0 ;

Plot1( vResult, "Result" ) ;

Started this thread Reply With Quote
 
(login for full post details)
  #10 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received


10handles,

you are trying to call the Moneyflow results from a function that computes the ADX. Take a look at the build in Moneyflow indicator that gives you a good idea on how to call the moneyflow function and use the value later in your code.
In Easylanguage you can reference values from previous bars by adding a square bracket to your variable. The number within the brackets is the number of bars you want to go back where 0 is the current bar.
So oMoneyFlow[1] would be the value from the previous bar. You will need to use this to check if the moneyflow is rising or falling.

Regards,
ABCTG





10handles View Post
Thanks. Here is what I have and I'm sure it is way off. I don't know EL.

inputs:
Length( 14 );

variables:
vResult( 0 ),
oMoneyFlow( 0 ) ;

Value1 = DirMovement( C, Length, oMoneyFlow ) ;

if oMoneyFlow < oMoneyFlow then
vResult = +1
else
vResult = 0 ;

Plot1( vResult, "Result" ) ;


Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators TradeStation > Scanning for indicator changes across 2 bars


Last Updated on November 25, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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