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
help for EL/PL code: crossing in more than one bar [SOLVED]
- 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
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.
Re: help for EL/PL code: crossing in more than one bar
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.
Thanks
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.
Thanks
- 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
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.
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.
Re: help for EL/PL code: crossing in more than one bar [SOLVED]
Clear.... I could only realise it with and/or statements. Thank you