Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

blib

EL Indicator Help

Recommended Posts

I am using the following show me code to run within RadarScreen to be applied to a number of instruments and generate dual alerts, once for a condition setup, the other for the condition trigger. I have set up counters to prevent extraneous setup alerts prior to the trigger and vice versa. I've had problems running this in the past parallel to a chart alert such that alerts generated through RadarScreen sometimes yielded data that was inconsistent with what was visible on a chart. I have checked off "Load additional data for cumulative calculations" box with bars set to 100 in both the chart and RadarScreen. Please take a look to see if there is anything else (possibly intrabarpersist) that may need to be added in order for this to work properly. Thank you.

 

 

 

Inputs: EMA_Length(20), ATR_Length(14);

Vars: XMA(0), AvgRange(0), UpperKC(0), LowerKC(0), trigger(0), impulse(0);

 

XMA = XAverage(Close,EMA_Length);

AvgRange=AvgTrueRange(ATR_Length);

UpperKC=XMA+(AvgRange*2.5);

LowerKC=XMA-(AvgRange*2.5);

 

 

if (High > UpperKC) or (Low < LowerKC) then Impulse=Impulse + 1;

if Impulse=1 then

begin

if (High > UpperKC) then Plot1 (High+AvgTrueRange(14), "KC", yellow);

if (Low alert("Keltner Violation");

trigger=0;

end ;

 

if Low crosses below XMA or High crosses above XMA then trigger = trigger + 1;

if trigger=1 then

begin

Plot2(XMA, "xma", yellow);

alert("Price at EMA");

impulse=0;

end ;

 

plot3((XMA+AvgRange),"+1ATR",yellow);

plot4((XMA-AvgRange),"-1ATR",yellow);

Share this post


Link to post
Share on other sites

if (High > UpperKC) or (Low < LowerKC) then Impulse=Impulse + 1;

if Impulse=1 then

begin

if (High > UpperKC) then Plot1 (High+AvgTrueRange(14), "KC", yellow);

if (Low alert("Keltner Violation"); <-- mismatched bracket, missing argument/then

trigger=0;

end ;

Share this post


Link to post
Share on other sites

apologies this is the correct code, but oddly enough the exp moving average remains static, any ideas why?

 

 

Inputs: MALen(20);

Vars: XMA(0), Price©, AvgRange(0), UpperKC(0), LowerKC(0), trigger(0), impulse(0);

 

XMA = XAverage(Price,MALen);

AvgRange=MAverage(TrueRange,MALen);

UpperKC=XMA+(AvgRange*2.5);

LowerKC=XMA-(AvgRange*2.5);

 

 

if (High > UpperKC) or (Low < LowerKC) then Impulse=Impulse + 1;

if Impulse=1 then

begin

if (High > UpperKC) then Plot1 (High+AvgTrueRange(14), "KC", yellow);

if (Low<LowerKC) then Plot1 (Low-AvgTrueRange(14), "KC", yellow);

alert("Keltner Violation");

trigger=0;

end ;

 

if Low crosses below XMA or High crosses above XMA then trigger = trigger + 1;

if trigger=1 and impulse>0 then

begin

Plot2(XMA, "xma", yellow);

alert("Price at EMA");

impulse=0;

end ;

 

plot3(UpperKC,"UpperKC",blue);

plot4(LowerKC,"LowerKC",blue);

plot5((XMA+AvgRange),"+1ATR",yellow);

plot6((XMA-AvgRange),"-1ATR",yellow);

plot7(xma,"xma");

Share this post


Link to post
Share on other sites
apologies this is the correct code, but oddly enough the exp moving average remains static, any ideas why?

 

move Price© from var: to input:

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.