NexusFi: Find Your Edge


Home Menu

 





Scanning for indicator changes across 2 bars


Discussion in TradeStation

Updated
    1. trending_up 3,675 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 16 posts
    2. attach_file 0 attachments




 
Search this Thread

Scanning for indicator changes across 2 bars

  #1 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

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 NexusFi?
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Spoo-nalysis ES e-mini futures S&P 500
14 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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
  #3 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2


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
Thanked by:
  #4 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

10handles,

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

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #5 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

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
Thanked by:
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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
Thanked by:
  #7 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

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
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

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
  #9 (permalink)
 10handles 
San Francisco CA
 
Experience: Beginner
Platform: TradeStation
Trading: Options
Posts: 10 since Apr 2014
Thanks Given: 4
Thanks Received: 2

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
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


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




Last Updated on November 25, 2021


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts