InSync Index

Modified on 2020/12/31 06:07 by Eugene — Categorized as: Community Indicators

Syntax


public InSyncIndex(Bars bars, string description)
public static InSyncIndex Series(Bars bars)

Parameter Description

bars A Bars object

Description

The Insync Index created by Norm North allows to show the consolidated status of an indicator group. Essentially, it's a consensus "master oscillator" that shows when a majority of the underlying indicators are acting in sync, suggesting that a turning point is near.

Interpretation

References:


Calculation


Example

Sample stop-and-reverse system based on InSync Index crossovers:


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class InSyncDemo : WealthScript { private StrategyParameter param1; private StrategyParameter param2; public InSyncDemo() { param1 = CreateParameter("Threshold 1", 5, 5, 35, 5); param2 = CreateParameter("Threshold 2", 95, 65, 95, 5); } protected override void Execute() { int t1 = param1.ValueInt; int t2 = param2.ValueInt; InSyncIndex i = InSyncIndex.Series( Bars ); ChartPane iPane = CreatePane( 30, true, false ); PlotSeries( iPane, i, Color.Blue, LineStyle.Solid, 1); DrawHorzLine( iPane, t1, Color.Black, LineStyle.Dashed, 1 ); DrawHorzLine( iPane, t2, Color.Black, LineStyle.Dashed, 1 ); HideVolume();

for(int bar = i.FirstValidValue * 3; bar < Bars.Count; bar++) { bool buy = (i[bar] > t1) && (i[bar-1] < t1); bool sell = (i[bar] < t2) && (i[bar-1] > t2);

// The first trade if (Positions.Count == 0){ if ( buy ) BuyAtMarket( bar + 1 ); else if( sell ) ShortAtMarket( bar + 1 ); } // Subsequent trades else { Position p = LastPosition; if ( p.PositionType == PositionType.Long ) { if ( sell ) { SellAtMarket( bar + 1, p ); ShortAtMarket( bar + 1 ); } } else if ( buy ) { CoverAtMarket( bar + 1, p ); BuyAtMarket( bar + 1 ); } } } } } }