CCT indikatörünün IQ ya uyarlanmış halidir.
LinRegSlope(C,13)+100*(Mov(Mov( ROC(C,1,$),34,E),21,E)/Mov( Mov( Abs( ROC(C,1,$)),34,E),21,E))+100*(Mov(Mov(C-(.5*(HHV(H,13)+LLV(L,13))),21,E),3,E)/(.5*Mov(Mov(HHV(H,13)-LLV(L,13),21,E),3,E)))::0
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using Matriks.Data.Identifiers;
using Matriks.Data.Symbol;
using Matriks.Engines;
using Matriks.Indicators;
using Matriks.Symbols;
using Matriks.AlgoTrader;
using Matriks.Trader.Core;
using Matriks.Trader.Core.Fields;
using Matriks.Trader.Core.TraderModels;
using Matriks.Lean.Algotrader.AlgoBase;
using Matriks.Lean.Algotrader.Models;
using Matriks.Lean.Algotrader.Trading;
namespace Matriks.Lean.Algotrader
{
/*
LinRegSlope(C,13)+100*(Mov(Mov( ROC(C,1,$),34,E),21,E)/Mov( Mov( Abs( ROC(C,1,$)),34,E),21,E))+100*(Mov(Mov(C-(.5*(HHV(H,13)+LLV(L,13))),21,E),3,E)/(.5*Mov(Mov(HHV(H,13)-LLV(L,13),21,E),3,E)))::0
*/
[IndicatorInformationAttribute("CCT", IndicatorDrawingArea.NewWindow)]
[IndicatorLineInformationAttribute(new []
{
"cct"
}, new []
{
"#FF0000"
}, new []
{
true
}, new []
{
5
}, new []
{
1
}
)]
public class CCT : MatriksIndicator
{
LowestLow lowestLow;
HighestHigh highestHigh;
ROC roc;
MOV mov1, mov2, mov3, mov4, mov5, mov6, mov7, mov8;
MOV C;
LRS lrs;
public sealed override void OnInit()
{
AddSymbol(Symbol, SymbolPeriod);
C = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, 1, MovMethod.Simple);
lrs = LRSIndicator(Symbol, SymbolPeriod, OHLCType.Close, 13);
roc = ROCIndicator(Symbol, SymbolPeriod, OHLCType.Close, 1);
mov1 = MOVIndicator(roc, 34, MovMethod.Exponential);
mov2 = MOVIndicator(mov1, 21, MovMethod.Exponential);
mov3 = MOVIndicator(roc, 34, MovMethod.Exponential);
mov4 = MOVIndicator(mov3, 21, MovMethod.Exponential);
highestHigh = HighestHighIndicator(Symbol, SymbolPeriod, 13);
lowestLow = LowestLowIndicator(Symbol, SymbolPeriod, 13);
mov5 = MOVIndicator(roc, 21, MovMethod.Exponential);
mov6 = MOVIndicator(mov3, 3, MovMethod.Exponential);
mov7 = MOVIndicator(roc, 21, MovMethod.Exponential);
mov8 = MOVIndicator(mov3, 3, MovMethod.Exponential);
}
public decimal a1 = 0, b1 = 0;
public override void OnDataUpdate(int currentBar, decimal inputValue, DateTime barDateTime)
{
var barData = GetBarData();
if (currentBar < 50)
{
SetLine(0, currentBar, 0);
return;
}
mov3.Update(Math.Abs(roc.CurrentValue), currentBar, barDateTime, null);
a1 = C.CurrentValue - (0.5m * (highestHigh.CurrentValue + lowestLow.CurrentValue));
mov5.Update(a1, currentBar, barDateTime, null);
b1 = highestHigh.CurrentValue - lowestLow.CurrentValue;
mov7.Update(b1, currentBar, barDateTime, null);
var result = lrs.CurrentValue + (100m * mov2.CurrentValue / mov4.CurrentValue) + (100m * mov5.CurrentValue / (0.5m * mov7.CurrentValue));
SetLine(0, currentBar, result);
}
}
}