Trading Articles
Article Categories
Article Tools
ACSIL_checking condition fulfillments in last 15 bars
Updated May 25, 2023
trending_up
72 views
thumb_up
0 thanks given
group
2 followers
forum
1 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 150,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)
ACSIL_checking condition fulfillments in last 15 bars
(login for full post details)
#1 (permalink )
Budapest, Hungary
Posts: 1 since May 2023
Thanks: 0 given,
0
received
Hi,
I created a code in ACSIL and I would like to ask some assistance how to code an additional condition. What I have done so far is I created three types of moving averages (RSI, EMA39, SMA ) and defined a condition accordig to which the color of the bar ha to be changed into green once SMA9 crosses EMA39 from below. Now I want to add a new condition, according to which the crossover is valid only in case the value of RSI was below at 32 at least once in last 15 bars. How to modify the code with this condition? Thanks in advance
Here is the existing code:
#include "sierrachart .h"
SCDLLName("Crossover")
SCSFExport scsf_RSI(SCStudyInterfaceRef sc)
{
SCSubgraphRef RSI = sc.Subgraph[0];
SCSubgraphRef EMA39 = sc.Subgraph[1];
SCSubgraphRef SMA9 = sc.Subgraph[2];
SCSubgraphRef Cross = sc.Subgraph[3];
SCSubgraphRef Subgraph_Cross = sc.Subgraph[4];
if (sc.SetDefaults)
{
// Set the defaults
sc.GraphName = "Crossover";
sc.GraphRegion = 0;
//sc.Subgraph[0].Name = "RSI14";
//sc.Subgraph[1].Name = "EMA39";
//sc.Subgraph[2].Name = "SMA9";
//sc.Subgraph[3].Name = "Cross";
//sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE;
//sc.Subgraph[1].DrawStyle = DRAWSTYLE_LINE;
//sc.Subgraph[2].DrawStyle = DRAWSTYLE_LINE;
//sc.Subgraph[3].DrawStyle = DRAWSTYLE_LINE;
Subgraph_Cross.Name = "movavgcross";
Subgraph_Cross.DrawStyle = DRAWSTYLE_COLOR_BAR;
Subgraph_Cross.PrimaryColor = RGB(0,255,0);
sc.AutoLoop = 1;
return;
}
// RSI definíció.
sc.RSI(sc.BaseDataIn[SC_LAST], RSI, MOVAVGTYPE_WILDERS, 14);
// EMA39 definíció.
sc.ExponentialMovAvg(RSI, EMA39, sc.Index, 39);
//SMA9 definíció
sc.SimpleMovAvg(RSI, SMA9, sc.Index, 9);
// Do data processing
if
( (sc.CrossOver(SMA9, EMA39) == CROSS_FROM_BOTTOM)
)
Subgraph_Cross[sc.Index] = 1;
else
Subgraph_Cross[sc.Index] = 0;
}
Can you help answer these questions from other members on futures io?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
Melbourne, Land of Oz
Experience: Advanced
Platform: Sierra Chart, CQG
Broker: CQG
Trading: HSI
Posts: 229 since Jun 2011
Thanks: 22 given,
334
received
Create a condition to check if the RSI < 30. If so store the bar index in a persistent int (RSILessThan30). Then add another condition to your crossover conditional check. if current bar index - RSILessThan30 =< 15
Last Updated on May 24, 2023