OPEN-SOURCE SCRIPT

Confluence script

This is modified version of Dale Legan's "Confluence" indicator written by Gary Fritz.
================================================================
Here is Gary`s commentary:
* I moved the core Confluence computations into a Confluence function.
Since the Confluence indicator returned several "states" (bull, bear, grey, and zero),
he modified the return value a bit:
-9 to -1 = Bearish
-0.9 to 0.9 = "grey" (and zero)
1 to 9 = Bullish
The "grey" range corresponds to the "grey" values plotted by Dale's indicator, but
they're divided by 10.
So -0.4 is equivalent to "grey -4" in Dale's indicator.
* I got rid of a bit of extra computation in the function. I didn't try to do a hard-core
Pierre-style optimization :-), but I noticed several significant chunks of calculation were
being done several times each bar, and I commented them out and replaced them with an intermediate
variable. It still calls sine/cosine a dozen times on each bar, which accounts for the bulk of the
processing time, but I think it's a bit easier to understand what the code is doing this way. (It also
seems to work better -- see below.) For the most part I didn't try to use mnemonic names for these
intermediate variables, because I don't understand exactly what the values represent!!
* I'm appending a simplified Confluence indicator using the function.
* I've also appended a simple Confluence system. This system sets an entry stop above/below the current
bar if Confluence goes into bull/bear mode, and similarly sets an exit stop below/above the bar where it
exits bull/bear mode. There's also an optional "aggressive" stop mode that tightens the stops if the market
moves in your direction; for example, if the high is 1000 and your "Trigger" offset is 2, the initial stop
is set at 1002. If the next bar has a high of 997, the stop is tightened to 997+2=999.
Interestingly, when I first wrote this system, I ran into a strange MaxBarsBack problem. The Confluence
indicator worked just fine with a MaxBarsBack setting of "Auto-Detect." But systems don't have a setting
like that -- you have to specify a fixed value. But NO fixed value (up to the maximum of 999) worked for
either the system OR the indicator! And I couldn't see anywhere that it was looking back that many bars.
Then, when I did the optimization on the Confluence code, the MaxBarsBack problem mysteriously disappeared.
Sometimes TradeStation is just spooky... Any ideas what happened?
I've appended a sample system report for the system on SPX, using the default parameters. The system actually
does pretty well. It probably won't make anyone rich, but I thought some folks might enjoy playing with it.
There are some other things you could do with it -- e.g. it might be interesting to change it to look for
long opportunities when Confluence hits -9, and short when it hits 9.
confluence

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?


他のメディア:

免責事項