Code: Select all
______ _____ _____ _ _ ______
| ___ \/ ___|_ _| | | (_) | ___ \
| |_/ /\ `--. | | | | _ _ __ ___| |_/ / __ ___
| / `--. \ | | | | | | '_ \ / _ \ __/ '__/ _ \
| |\ \ /\__/ /_| |_ | |___| | | | | __/ | | | | (_) |
\_| \_|\____/ \___/ \_____/_|_| |_|\___\_| |_| \___/
I created this indicator yesterday. It's trendlines over a RSI oscillator
it's nothing new, but I never found one that isn't messy with the alerts, and/or repainting at least 1 bar
on this version, the actual bar is when the rsi/trenline crosses happen. so at the close of the bar, you will get the arrows on the previous bar.
it's synced with the chart as it should be for everyday use.
it can be a bit slow because it checks *every* possible trendline with every peak it finds (the lookbar period is the actual number of peaks it looks for, not the number of bars)
you can filter trendlines according to their slope or how many bars there are between peaks
npeaks = 10;//number of peaks to process
so it will look for a peak (a simple /\ in the rsi) then looks backwards for 'npeaks' peaks and determine a trendline
if the trendline is correct according to the settings it is drawn with an arrow,
if not, the algo skips to the next peak.
and if the first peak on the right doesn't bring any trend line, it will go to the next one and restart the whole process
so for each bar there are npeak^2 trendlines tested. which can be heavy on CPU.
To mitigate that, just lower npeaks a bit (like 7-8 is usually enough)
minPeaksHeight = 0;//minimum peak height
a peak can be really pointy or almost flat.
This parameter sets the minimum height of a peak to keep only the pointier ones
minPeaksDist = 10;
minimum distance between the two peaks
extern double minSlope = 1.5;
minimum slope of the trendline. The bigger the number the more slanted
extern bool filterNegativeSlopes = false;
do not keep trendlines with negative slopes
extern double maxRSI = 50;
this is to ensure the signals are at the bottom of the rsi chart for buys and inversely for sells.
if you want no filter just set it to 100.
this indicator has a time limitation. But it's only to filter out older non working version.
once it works as it should i'll release the whole code. for free
Jeff
what about examples ?
it can be really good like these ones:
or a little less good like these ones :
let me know if you want more features and i'll add em!