help for EL/PL code: crossing in more than one bar  [SOLVED]

Questions about MultiCharts and user contributed studies.
auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

help for EL/PL code: crossing in more than one bar

Postby auato » 28 Jul 2018

Hi,

I am using the “cross below” and “cross above” statements to trigger my entries when a "moving average" crosses other moving averages. But in this case the script runs well if the crossing occurs in the same bar, of course.
But I'd like also to trigger my entry when the "moving average" finishes the crossing of the others in more then one bar (i.e. two or three bars before it started to cross some of them and finishes to cross only a few bars after) and I don't know the exact order of the others moving average to be cut (what will be the fisrt, the second, the third... "moving average" to be cut)

Thank you,
auato

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: help for EL/PL code: crossing in more than one bar

Postby TJ » 28 Jul 2018

Hi,

I am using the “cross below” and “cross above” statements to trigger my entries when a "moving average" crosses other moving averages. But in this case the script runs well if the crossing occurs in the same bar, of course.
But I'd like also to trigger my entry when the "moving average" finishes the crossing of the others in more then one bar (i.e. two or three bars before it started to cross some of them and finishes to cross only a few bars after) and I don't know the exact order of the others moving average to be cut (what will be the fisrt, the second, the third... "moving average" to be cut)

Thank you,
auato

Please give a specific example.

Please draw a mock-up chart to illustrate your imagination.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: help for EL/PL code: crossing in more than one bar

Postby auato » 28 Jul 2018

Hi TJ, thank you.
Here attached what I imagine. Created the code for the case "1 bar cut" by "cross below/above" instructions. But if the purple line goes through the others in more than one bar I need a completely renewed code, I suppose.

barcut.JPG
(83.32 KiB) Downloaded 420 times

Thanks

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: help for EL/PL code: crossing in more than one bar

Postby TJ » 28 Jul 2018

You need to describe the "Critical Event".

ie.
What is the "Normal" state,

and

What is the "Abnormal" state ?


The normal state being the previous bar,
the "abnormal" state being the current bar that has triggered a "Change".

You need to list out ALL the characteristics of each state.

For example,
The normal state is
C> Average#1
C> Average#2
C> Average#3

The abnormal normal state is
C< Average#1
C< Average#2
C< Average#3


After you have identified all the characteristics,
you then code each condition accordingly.

auato
Posts: 89
Joined: 23 Nov 2016
Has thanked: 18 times

Re: help for EL/PL code: crossing in more than one bar  [SOLVED]

Postby auato » 28 Jul 2018

Clear.... I could only realise it with and/or statements. Thank you


Return to “MultiCharts”