Classification of evenets in Time (Arrow?)
11/24/2022 at 9:51 AM #20475111/25/2022 at 1:46 PM #20482211/25/2022 at 2:38 PM #20482511/25/2022 at 4:35 PM #20483011/25/2022 at 9:31 PM #20484011/25/2022 at 9:53 PM #204841
I use PRT V11.1234567891011121314Defparam DRAWONLASTBARONLY=truecl=closeif cl>cl thenDRAWSEGMENT(barindex+2, cl, barindex+7, cl)coloured(0,105,255,255)DRAWTEXT(" #cl#(Dyn.Close)", barindex+10, close)coloured(0,105,255,255)elsif cl <clthenDRAWSEGMENT(barindex+2, cl, barindex+7, cl)coloured(255,55,0,255)DRAWTEXT(" #cl#(Dyn.Close)", barindex+8, close)coloured(255,55,0,255)elseDRAWSEGMENT(barindex+2, cl, barindex+5, cl)coloured(255,255,255)DRAWTEXT(" #cl#(Dyn.Close)", barindex+10, close)coloured(255,255,255,255)endifreturn
1 user thanked author for this post.11/27/2022 at 10:20 PM #204920
The JK indicator gives signals down and up. (red and blue)
How can you program and record the last ten times of these signals in PRT language.
Oldest = e.g. T1 then T2…… T10 in the attached example 8 signals down and 2 signals up.11/28/2022 at 4:14 AM #204925
To record the last N signals you need to use an N-element array for each datum you are interested in.
If you want to save the BarIndex of the signal you may use $SignalBAR[N].
If you also need to save the type (Long, Short), then you may also use $SignalTYPE[N], and so on…
I recommend that you initialize to 0 all N elements on barindex 0, the very first bar.
Whenever s new signal is returned, shift all elements from 1 to N-1 one place, then store the new signal as element 1 (your former element 10 will be dropped).
You will always have the last N signals in the correct order.
Any N-element stored with 0 is a void signal, not yet filled.
Since the first element in the array is element 0, which may slightly complicate maths on element indexing, I recommend initializing N+1 elements (elements 0 to 10 for 10 elements, instead of 0-9, then using only elements 1 to 10).
1 user thanked author for this post.