Remove Background from CoronaSwingPsn??? - NinjaTrader | futures io social day trading
futures io futures trading


Remove Background from CoronaSwingPsn???
Updated: Views / Replies:1,496 / 1
Created: by tdaman Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Remove Background from CoronaSwingPsn???

  #1 (permalink)
Elite Member
Colorado Springs
 
Futures Experience: Intermediate
Platform: Sierra Chart, Ninja Trader
Broker/Data: IQFeed, AMP/CQG
Favorite Futures: EC, ES, TF
 
tdaman's Avatar
 
Posts: 130 since Oct 2010
Thanks: 37 given, 20 received

Remove Background from CoronaSwingPsn???

I need the background removed from the CoronaSwingPsn indicator. Not being a programmer I've made simple edits before but this one has me stumped. Is there a section of the NT7 code below that simply needs removed? Thank you very much to any knowledgeable programmer!!!

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;

namespace NinjaTrader.Indicator
{
/// <summary>
/// John Ehlers Corona Indicators
/// ported to NT by sefstrat
/// </summary>
[Description("Corona Swing Position")]
[Gui.Design.DisplayName(" Corona SwingPosition")]
public class CoronaSwingPsn : Indicator
{
#region Variables
private DataSeries _domCyc;
private DataSeries _domCycMdn;
private DataSeries _smoothHP;
private DataSeries _highPass;
private DataSeries _bandPass;

ArrayList leadList = new ArrayList(51);
ArrayList posList = new ArrayList(21);

private Color[] _colors;
private Dictionary<int, FilterBank[]> _filters;

private FilterBank[] bank
{
get { return _filters[CurrentBar]; }
}

#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{

Add(new Plot(new Pen(Color.Aquamarine, 3), "Swing"));

_filters = new Dictionary<int, FilterBank[]>();

#region Colors
_colors= new Color[21];
for (int n = 0; n <= 10; n++)
{
int c1 = 180 - (18 * n);
int c2 = 255 - (8 * n);
int c3 = 210 - (15 * n);
_colors[n] = Color.FromArgb(c1, c2, c3);
}
for (int n = 11; n <= 20; n++)
{
int c2 = (int)(172 * (2 - n / 10d));
int c3 = (int)(64 * (2 - n / 10d));
_colors[n] = Color.FromArgb(0, c2, c3);
}
#endregion

#region DataSeries
_domCyc = new DataSeries(this);
_highPass = new DataSeries(this);
_smoothHP = new DataSeries(this);
_domCycMdn = new DataSeries(this);
_bandPass = new DataSeries(this);
#endregion

CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}


protected override void OnBarUpdate()
{
if (CurrentBar < 12) return;


double alpha = (1 - Math.Sin(twoPi / 30)) / Math.Cos(twoPi / 30);

if (CurrentBar == 12)
{
FilterBank[] b = new FilterBank[60];
for (int n = 1; n < 60; n++)
b[n] = new FilterBank();
_filters[12] = b;

for(int bar = 1; bar < CurrentBar; bar++)
{
_highPass[bar] = 0.5 * (1 + alpha)* Momentum(Input, 1)[bar] + alpha * _highPass[bar+1];
}
}
else
{
_highPass[0] = 0.5 * (1 + alpha)* Momentum(Input, 1)[0] + alpha * _highPass[1];
FilterBank[] b = new FilterBank[60];
for (int n = 1; n < 60; n++)
b[n] = (FilterBank)_filters[CurrentBar - 1][n].Clone();
_filters[CurrentBar] = b;
}

_smoothHP[0] = (_highPass[0] + 2 * _highPass[1] + 3 * _highPass[2] + 3 * _highPass[3] + 2 * _highPass[4] + _highPass[5]) / 12;

double maxAmpl = 0d;
double delta = -0.015 * CurrentBar + 0.5;
delta = delta < 0.1 ? 0.1 : delta;

for (int n = 11; n < 60; n++)
{
double beta = Math.Cos(4*Math.PI / (n+1));
double gamma = 1 / Math.Cos(8*Math.PI * delta / (n+1));
double a = gamma - Math.Sqrt(gamma * gamma - 1);
bank[n].Q[0] = (_smoothHP[0] - _smoothHP[1]) * ((n+1)/4/Math.PI);
bank[n].I[0]= _smoothHP[0];
bank[n].R[0]= 0.5 * (1 - a) * (bank[n].I[0]- bank[n].I[2]) + beta * (1 + a) * bank[n].R[1] - a * bank[n].R[2];
bank[n].Im[0] = 0.5 * (1 - a) * (bank[n].Q[0] - bank[n].Q[2]) + beta * (1 + a) * bank[n].Im[1] - a * bank[n].Im[2];
bank[n].Amplitude = bank[n].R[0]* bank[n].R[0]+ bank[n].Im[0] * bank[n].Im[0];
maxAmpl = bank[n].Amplitude > maxAmpl ? bank[n].Amplitude : maxAmpl;
}


double num = 0; double den = 0;
for (int n = 11; n < 60; n++)
{
bank[n].I[2] = bank[n].I[1];
bank[n].I[1] = bank[n].I[0];
bank[n].Q[2] = bank[n].Q[1];
bank[n].Q[1] = bank[n].Q[0];
bank[n].R[2] = bank[n].R[1];
bank[n].R[1] = bank[n].R[0];
bank[n].Im[2] = bank[n].Im[1];
bank[n].Im[1] = bank[n].Im[0];
bank[n].dB[1] = bank[n].dB[0];

if (maxAmpl != 0 && bank[n].Amplitude / maxAmpl > 0){
bank[n].dB[0] = -10 * Math.Log(.01 / (1 - 0.99 * bank[n].Amplitude / maxAmpl)) / Math.Log(10);
}

bank[n].dB[0] = 0.33 * bank[n].dB[0] + 0.67 * bank[n].dB[1];
bank[n].dB[0] = bank[n].dB[0] > 20 ? 20 : bank[n].dB[0];

if (bank[n].dB[0] <= 6)
{
num += n * (20 - bank[n].dB[0]);
den += (20 - bank[n].dB[0]);
}
if (den != 0) _domCyc.Set(0.5 * num / den);
}

_domCycMdn[0] = GetMedian(_domCyc, 5);
_domCycMdn[0] = _domCyc[0] < 6 ? 6 : _domCyc[0];


double delta2 = .1;
double beta2 = Math.Cos(twoPi / _domCycMdn[0]);
double g2 = 1 / Math.Cos(fourPi * delta2 / _domCycMdn[0]);
double alpha2 = g2 - Math.Sqrt(g2 * g2 - 1);
_bandPass[0] = 0.5 * (1 - alpha2) * (Input[0] - Input[2])
+ beta2 * (1 + alpha2) * _bandPass[1] - alpha2 * _bandPass[2];
double Q2 = (_domCycMdn[0] / twoPi) * (_bandPass[0] - _bandPass[1]);
double lead60 = .5*_bandPass[1]+.866*Q2;
double HL, LL;
PhaseList(ref leadList, 50, lead60, out HL, out LL);
double Psn = (lead60 - LL) / (HL - LL);
PhaseList(ref posList, 20, Psn, out HL, out LL);

double cWidth = HL-LL > 0.85 ? 0.01 : 0.15*(HL-LL);


Value.Set( 10 * Psn - 5d);

int psn50 = (int)Math.Round(50 * Psn);

for (int n = 1; n < 51; n++)
{
bank[n].Raster[1] = bank[n].Raster[0];
bank[n].Raster[0] = 20d;
if (n < psn50)
bank[n].Raster[0] = 0.5 * (Math.Pow((20 * Psn - 0.4 * n) / cWidth, 0.95) + 0.5 * bank[n].Raster[1]);
else if (n > psn50 && (0.4*n-20*Psn)/cWidth > 1)
bank[n].Raster[0] = 0.5 * (Math.Pow((-20 * Psn + 0.4 * n) / cWidth, 0.95) + 0.5 * bank[n].Raster[1]);
else if (n == psn50)
bank[n].Raster[0] = 0.5 * bank[n].Raster[1];
if (bank[n].Raster[0] > 20) bank[n].Raster[0] = 20;
else if (bank[n].Raster[0] < 0) bank[n].Raster[0] = 0;
if (HL - LL > 0.8) bank[n].Raster[0] = 20;
}
}

// Keep cntMax fifo samples and find the Highest and Lowest lead for samples in the list
private void PhaseList(ref ArrayList list, int cntMax, double lead, out double H, out double L)
{
H = lead; L = lead;
if (list.Count < cntMax)
list.Add(lead);
else
{
list.RemoveAt(0);
list.Add(lead);
}
for (int n = 0; n < list.Count - 1; n++)
{
double val = (double)list[n];
if (val > H) H = val;
if (val < L) L = val;
}
}
public override void GetMinMaxValues(ChartControl chartControl, ref double min, ref double max)
{
min = -5;
max = 5;
return;
}

public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
drawCorona(graphics, bounds, min, max);
base.Plot(graphics, bounds, min, max);
}

private void drawCorona(Graphics graphics, Rectangle bounds, double min, double max)
{
if (base.Bars != null)
{
int barPaintWidth = ChartControl.ChartStyle.GetBarPaintWidth(ChartControl.BarWidth);
SmoothingMode smoothingMode = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;

int bars = ChartControl.BarsPainted;
double y1;
double vscale = bounds.Height / ChartControl.MaxMinusMin(max, min);
Exception caughtException;
while (bars >= 0)
{
int index = ChartControl.LastBarPainted - ChartControl.BarsPainted + 1 + bars;
if (ChartControl.ShowBarsRequired || ((index - base.Displacement) >= base.BarsRequired))
{
try
{
double x1 = (((ChartControl.CanvasRight - ChartControl.BarMarginRight) - (barPaintWidth / 2))
- ((base.ChartControl.BarsPainted - 1) * base.ChartControl.BarSpace))
+ (bars * (base.ChartControl.BarSpace));
for (int i = 1; i < 51; ++i)
{
double v = .2*i-5;// -.5 * .2;
y1 = (bounds.Y + bounds.Height) - (int)((v - min) * vscale + 0.5);
double y2 = (bounds.Y + bounds.Height) - (int)((v + 1 - min) * vscale + 0.5);
SolidBrush brush = new SolidBrush(_colors[(int) Math.Round(_filters[index][i].Raster[0])]);
int width = (int)(barPaintWidth + ChartControl.BarSpaceIntern);
graphics.FillRectangle(brush, new Rectangle((int)x1 - width / 2, (int)y2, width, (int)Math.Abs(y1 - y2)));

}
}
catch (Exception exception) { caughtException = exception; }
}
bars--;
}

graphics.SmoothingMode = smoothingMode;
}
}


#region Properties

[Browsable(false)]
[XmlIgnore()]
public DataSeries SwingPsn
{
get { return Values[0]; }
}

#endregion

public const double twoPi = 2 * Math.PI;
public const double fourPi = 4 * Math.PI;

protected class FilterBank : ICloneable
{ // current, old, older
internal double[] I = new double[3];
internal double[] Q = new double [3];
internal double[] R = new double [3];
internal double[] Im = new double[3];
internal double Amplitude = 0;
internal double[] dB = new double[2];
internal double[] Raster = new double[2];

public object Clone()
{
FilterBank clone = new FilterBank();

I.CopyTo(clone.I, 0);
Q.CopyTo(clone.Q, 0);
R.CopyTo(clone.R, 0);
Im.CopyTo(clone.Im, 0);
clone.Amplitude = Amplitude;
dB.CopyTo(clone.dB, 0);
Raster.CopyTo(clone.Raster, 0);

return clone;
}
}
}
}
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private CoronaSwingPsn[] cacheCoronaSwingPsn = null;

private static CoronaSwingPsn checkCoronaSwingPsn = new CoronaSwingPsn();

/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
public CoronaSwingPsn CoronaSwingPsn()
{
return CoronaSwingPsn(Input);
}

/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
public CoronaSwingPsn CoronaSwingPsn(Data.IDataSeries input)
{
if (cacheCoronaSwingPsn != null)
for (int idx = 0; idx < cacheCoronaSwingPsn.Length; idx++)
if (cacheCoronaSwingPsn[idx].EqualsInput(input))
return cacheCoronaSwingPsn[idx];

lock (checkCoronaSwingPsn)
{
if (cacheCoronaSwingPsn != null)
for (int idx = 0; idx < cacheCoronaSwingPsn.Length; idx++)
if (cacheCoronaSwingPsn[idx].EqualsInput(input))
return cacheCoronaSwingPsn[idx];

CoronaSwingPsn indicator = new CoronaSwingPsn();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
Indicators.Add(indicator);
indicator.SetUp();

CoronaSwingPsn[] tmp = new CoronaSwingPsn[cacheCoronaSwingPsn == null ? 1 : cacheCoronaSwingPsn.Length + 1];
if (cacheCoronaSwingPsn != null)
cacheCoronaSwingPsn.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheCoronaSwingPsn = tmp;
return indicator;
}
}
}
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.CoronaSwingPsn CoronaSwingPsn()
{
return _indicator.CoronaSwingPsn(Input);
}

/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
public Indicator.CoronaSwingPsn CoronaSwingPsn(Data.IDataSeries input)
{
return _indicator.CoronaSwingPsn(input);
}
}
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.CoronaSwingPsn CoronaSwingPsn()
{
return _indicator.CoronaSwingPsn(Input);
}

/// <summary>
/// Corona Swing Position
/// </summary>
/// <returns></returns>
public Indicator.CoronaSwingPsn CoronaSwingPsn(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

return _indicator.CoronaSwingPsn(input);
}
}
}
#endregion

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Reply



futures io > > > > Remove Background from CoronaSwingPsn???

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
background for diffenrt sessions template razorbuzz NinjaTrader 46 May 20th, 2016 02:00 PM
Add Background Color function to an indicator michaelf NinjaTrader Programming 33 October 15th, 2014 06:34 PM
Background color neilzep NinjaTrader 4 May 17th, 2011 11:58 PM
Set Background Color in EasyLanguage Big Mike EasyLanguage Programming 5 October 27th, 2010 01:45 PM
Do you keep changing the background colors of your charts? sharp2be NinjaTrader 7 April 16th, 2010 03:55 PM


All times are GMT -4. The time now is 11:58 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-17 in 0.13 seconds with 21 queries on phoenix via your IP 54.90.92.204