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,801 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)
  #11 (permalink)
clockworkman
Akron, OH
 
 
Posts: 6 since Nov 2021
Thanks: 0 given, 2 received


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 futures io?
Google Keyword Search Alerts
Traders Hideout
Does anyone have the code for Anchored Vwap to use in Qu …
Traders Hideout
What are the main Eurobond futures and their respective …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Vinny E-Mini & Algobox Review TRADE ROOM
45 thanks
Design a DayTrader Scalping Order Flow Indicator
22 thanks
Daytrading.Coach Review
11 thanks
The Wheel Strategy on Options
9 thanks
AMA: FuturesTrader71 (FT71) / Morad Askar - Ask Me Anything
9 thanks
 
(login for full post details)
  #12 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

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
 
(login for full post details)
  #13 (permalink)
clockworkman
Akron, OH
 
 
Posts: 6 since Nov 2021
Thanks: 0 given, 2 received



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
The following user says Thank You to clockworkman for this post:
 
(login for full post details)
  #14 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

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
 
(login for full post details)
  #15 (permalink)
clockworkman
Akron, OH
 
 
Posts: 6 since Nov 2021
Thanks: 0 given, 2 received


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
 
(login for full post details)
  #16 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,304 since Apr 2013
Thanks: 420 given, 1,535 received

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
 
(login for full post details)
  #17 (permalink)
clockworkman
Akron, OH
 
 
Posts: 6 since Nov 2021
Thanks: 0 given, 2 received


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


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