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

  #11 (permalink)
clockworkman
Akron, OH
 
Posts: 7 since Nov 2021
Thanks Given: 0
Thanks Received: 3


ABCTG View Post
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


Hello

I have a simialr issue and was wondering if you could help me. I use an indicator called StochRSI, here is the easy language:

{StoRSI}
inputs: RSILen(12), StoLen(20), MA(3), MA2(5);

vars: PV(0), pvt(0), pvb(0);
vars: OverBought(80), OverSold(20), Middle (50);
Vars: Sum(0), Counter(0);

pvt = RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen);
pvb = Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen);

Sum = 0;
For counter = 0 To MA - 1 Begin
pvt = (RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;
pvb = (Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;

PV = iff(pvb > 0, pvt/pvb, 0);
Sum = Sum + PV;
End;

PV = iff(MA > 0, Sum / MA, 0);

plot1(PV*100, "StoRSI");
plot2(average(PV,MA2)*100, "StoRSI2");
plot3(OverBought, "OB");
plot4(OverSold, "OS");
Plot5(Middle, "M");


I would like to create a scan that will tell when the StoRSI2 indicator is rising or falling. For instance below 100 and falling or above 0 and rising. Any help would be greatly appreciated!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #12 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

clockworkman,

one way to approach this is to assign the value you plot as "StoRSI2" to a variable. Then you can compare the current bar's value against the previous bar's value (see the reply for 10handles for how to do that) and trigger an alert or use a plot to display this information. Both the alert or plot could be used in a scan.

Regards,

ABCTG


clockworkman View Post
Hello

I have a simialr issue and was wondering if you could help me. I use an indicator called StochRSI, here is the easy language:

{StoRSI}
inputs: RSILen(12), StoLen(20), MA(3), MA2(5);

vars: PV(0), pvt(0), pvb(0);
vars: OverBought(80), OverSold(20), Middle (50);
Vars: Sum(0), Counter(0);

pvt = RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen);
pvb = Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen);

Sum = 0;
For counter = 0 To MA - 1 Begin
pvt = (RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;
pvb = (Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;

PV = iff(pvb > 0, pvt/pvb, 0);
Sum = Sum + PV;
End;

PV = iff(MA > 0, Sum / MA, 0);

plot1(PV*100, "StoRSI");
plot2(average(PV,MA2)*100, "StoRSI2");
plot3(OverBought, "OB");
plot4(OverSold, "OS");
Plot5(Middle, "M");


I would like to create a scan that will tell when the StoRSI2 indicator is rising or falling. For instance below 100 and falling or above 0 and rising. Any help would be greatly appreciated!


Follow me on Twitter Reply With Quote
  #13 (permalink)
clockworkman
Akron, OH
 
Posts: 7 since Nov 2021
Thanks Given: 0
Thanks Received: 3



ABCTG View Post
clockworkman,

one way to approach this is to assign the value you plot as "StoRSI2" to a variable. Then you can compare the current bar's value against the previous bar's value (see the reply for 10handles for how to do that) and trigger an alert or use a plot to display this information. Both the alert or plot could be used in a scan.

Regards,

ABCTG

Hello ABCTG

Thank you for the reply. Would I add the StoRSI2 variable with the other variables in this code or start at the bottom or does it not matter? I am new to easylanguage. I think I can follow your other example to get the current bar vs previous bar and add that to the end of the current code.

Thanks!

Reply With Quote
Thanked by:
  #14 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

clockworkman,

this is up to you. In the interest of writing code that is easier to read and maintain it can make sense to declare all variables in one place, though.

Regards,

ABCTG


clockworkman View Post
Hello ABCTG

Thank you for the reply. Would I add the StoRSI2 variable with the other variables in this code or start at the bottom or does it not matter? I am new to easylanguage. I think I can follow your other example to get the current bar vs previous bar and add that to the end of the current code.

Thanks!


Follow me on Twitter Reply With Quote
  #15 (permalink)
clockworkman
Akron, OH
 
Posts: 7 since Nov 2021
Thanks Given: 0
Thanks Received: 3


ABCTG View Post
clockworkman,

this is up to you. In the interest of writing code that is easier to read and maintain it can make sense to declare all variables in one place, though.

Regards,

ABCTG

Here is what I have come up with based on your previous post. I am getting a "more inputs expected here" error on Value1 when trying to verify. Thoughts?

{StoRSI}
inputs: RSILen(12), StoLen(20), MA(3), MA2(5);

vars: PV(0), pvt(0), pvb(0);
vars: OverBought(80), OverSold(20), Middle (50);
Vars: Sum(0), Counter(0);

pvt = RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen);
pvb = Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen);

Sum = 0;
For counter = 0 To MA - 1 Begin
pvt = (RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;
pvb = (Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;

PV = iff(pvb > 0, pvt/pvb, 0);
Sum = Sum + PV;
End;

PV = iff(MA > 0, Sum / MA, 0);

plot1(PV*100, "StoRSI");
plot2(average(PV,MA2)*100, "StoRSI2");
plot3(OverBought, "OB");
plot4(OverSold, "OS");
Plot5(Middle, "M");

variables:
vDirection ( 0 ),
StoRSI2( 0 ) ;

Value1 = DirMovement( StoRSI2 ) ;

if StoRSI2 > StoRSI2[1] then
vDirection = + 1
else
vDirection = 0 ;

Plot6( vDirection, "Direction" ) ;

Reply With Quote
  #16 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

clockworkman,

DirMovement has no relevance for your particular problem. At least it is not clear from your code why you are using it. You could simply move the variable declaration to the top where the other variables are declared and initialized. This would allow you to add the below before plot1:

 
Code
StoRSI2 = average(PV,MA2)*100 ;

plot1(PV*100, "StoRSI"); 
plot2(StoRSI2, "StoRSI2");
Now your direction check should work, if you follow the steps I described above (including moving the declaration of StoRSI2 to the top)..

Regards,

ABCTG



clockworkman View Post
Here is what I have come up with based on your previous post. I am getting a "more inputs expected here" error on Value1 when trying to verify. Thoughts?

{StoRSI}
inputs: RSILen(12), StoLen(20), MA(3), MA2(5);

vars: PV(0), pvt(0), pvb(0);
vars: OverBought(80), OverSold(20), Middle (50);
Vars: Sum(0), Counter(0);

pvt = RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen);
pvb = Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen);

Sum = 0;
For counter = 0 To MA - 1 Begin
pvt = (RSI(Close, RSILen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;
pvb = (Highest(RSI(Close, RSILen), STOLen) - Lowest(RSI(Close, RSILen), STOLen)) of counter bars ago;

PV = iff(pvb > 0, pvt/pvb, 0);
Sum = Sum + PV;
End;

PV = iff(MA > 0, Sum / MA, 0);

plot1(PV*100, "StoRSI");
plot2(average(PV,MA2)*100, "StoRSI2");
plot3(OverBought, "OB");
plot4(OverSold, "OS");
Plot5(Middle, "M");

variables:
vDirection ( 0 ),
StoRSI2( 0 ) ;

Value1 = DirMovement( StoRSI2 ) ;

if StoRSI2 > StoRSI2[1] then
vDirection = + 1
else
vDirection = 0 ;

Plot6( vDirection, "Direction" ) ;


Follow me on Twitter Reply With Quote
  #17 (permalink)
clockworkman
Akron, OH
 
Posts: 7 since Nov 2021
Thanks Given: 0
Thanks Received: 3


ABCTG View Post
clockworkman,

DirMovement has no relevance for your particular problem. At least it is not clear from your code why you are using it. You could simply move the variable declaration to the top where the other variables are declared and initialized. This would allow you to add the below before plot1:

 
Code
StoRSI2 = average(PV,MA2)*100 ;

plot1(PV*100, "StoRSI"); 
plot2(StoRSI2, "StoRSI2");
Now your direction check should work, if you follow the steps I described above (including moving the declaration of StoRSI2 to the top)..

Regards,

ABCTG

Thank you, that worked. I removed DirMovement after I downloaded the easylanguage manual and realized it made no sense for what I needed.

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