NexusFi: Find Your Edge


Home Menu

 





1 Signal from 3 Indicators


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one KrazyTrader with 6 posts (0 thanks)
    2. looks_two TheWizard with 5 posts (3 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 odmassion with 1 posts (0 thanks)
    1. trending_up 3,657 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

1 Signal from 3 Indicators

  #1 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9

Hello,

I'm using @Fat Tails SuperTrend and Keltner for indicators.
I'm currently using something like this for background color:

// Long
if SuperTrend.UpTrend && Fast > Slow && Slow (rising)
{
BackGround Color UpColor
}
// Short is opposite and Neutral is everything else.

I had a breakthrough earlier this week when @Fat Tails showed me how to get SuperTrend simplified to STU=anaSuperTrend.etc,etc. Now I'm thinking conditions I have for background colors could trigger signals.

I'm hoping for something like-
LONG=SuperTrend.UpTrend && Fast > Slow && Slow (rising)

// Long
if LONG [1] = false && LONG [0]=true
{
LONG Signal
}

I'm willing to do my own fishing if someone can send me to the place.

Thanks in advance.

Difference between discomfort and pain = 1 tick
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Deepmoney LLM
Elite Quantitative GenAI/LLM
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
25 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #3 (permalink)
 
TheWizard's Avatar
 TheWizard 
Houston, TX
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Optimus Futures, AMP, CQG
Trading: 6E
Posts: 1,731 since Jun 2009
Thanks Given: 517
Thanks Received: 4,224



KrazyTrader View Post
Hello,

I'm using @Fat Tails SuperTrend and Keltner for indicators.
I'm currently using something like this for background color:

// Long
if SuperTrend.UpTrend && Fast > Slow && Slow (rising)
{
BackGround Color UpColor
}
// Short is opposite and Neutral is everything else.

I had a breakthrough earlier this week when @Fat Tails showed me how to get SuperTrend simplified to STU=anaSuperTrend.etc,etc. Now I'm thinking conditions I have for background colors could trigger signals.

I'm hoping for something like-
LONG=SuperTrend.UpTrend && Fast > Slow && Slow (rising)

// Long
if LONG [1] = false && LONG [0]=true
{
LONG Signal
}

I'm willing to do my own fishing if someone can send me to the place.

Thanks in advance.

@KrazyTrader,

For the Long / Short signal insert code:

BackColor = Color.FromArgb(opacity, Color.Blue); (ex: Long - Blue / Short - Red, or any other colors you prefer)

In the Variables section, insert code:

private int opacity = 100; (this allows you to control the opacity of the color; 10%, 20%, etc up to 100%)

In the Properties section, insert code:

[Description("Background opacity")]
[GridCategory("Parameters")]
public int Opacity
{
get { return opacity; }
set { opacity = (value); }
}


This defines the field called "opacity", which will pop up in the indicator preferences panel and allow you to specify the opacity percentage (10, 20, up to 100%)

Hope that helps.

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote
  #4 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9


TheWizard View Post
@KrazyTrader,

For the Long / Short signal insert code:

BackColor = Color.FromArgb(opacity, Color.Blue); (ex: Long - Blue / Short - Red, or any other colors you prefer)

In the Variables section, insert code:

private int opacity = 100; (this allows you to control the opacity of the color; 10%, 20%, etc up to 100%)

In the Properties section, insert code:

[Description("Background opacity")]
[GridCategory("Parameters")]
public int Opacity
{
get { return opacity; }
set { opacity = (value); }
}


This defines the field called "opacity", which will pop up in the indicator preferences panel and allow you to specify the opacity percentage (10, 20, up to 100%)

Hope that helps.


Thanks,

Any way to code something that would work as a trade signal?

Difference between discomfort and pain = 1 tick
Started this thread Reply With Quote
  #5 (permalink)
 
TheWizard's Avatar
 TheWizard 
Houston, TX
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Optimus Futures, AMP, CQG
Trading: 6E
Posts: 1,731 since Jun 2009
Thanks Given: 517
Thanks Received: 4,224


KrazyTrader View Post
Thanks,

Any way to code something that would work as a trade signal?

@KrazyTrader,

I'd have to see the indicator you're talking about. Post it here, or send it to me in a Private Message and I'll take a look to see where to insert the code. There are plenty of indicators out there that generate trade signals. The question is - are they good signals?

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote
  #6 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9


TheWizard View Post
@KrazyTrader,

I'd have to see the indicator you're talking about. Post it here, or send it to me in a Private Message and I'll take a look to see where to insert the code. There are plenty of indicators out there that generate trade signals. The question is - are they good signals?

Thanks in advance for taking your time to look at this.

First a disclaimer: This is more of a learning experience to improve my coding ability than me being set on a signal.

What i'm curious about... I would like to use the code in //ColorBars to create a signal like I have in //Long SetUp. My thinking is to create something like:
LONG =if (EMA(8)[0]> SMA (20)[0]&& STU.UpTrend [0]&& KU.Trend [0]> 0 )
and then i could use something like--
if LONG [1] == false && LONG [0]==true
{
DrawArrow/ or enter market or something!!
}
I don't know if what I'm asking is possible...but my limited knowledge has me thinking it would simplify/optimize signals and entries.

This is current state:

#region Variables
//SuperTrendU11
private double multiplier = 1.618;
private int rangePeriod = 3;
private int basePeriod = 3;
private anaSuperTrendU11BaseType thisBaseType = anaSuperTrendU11BaseType.Median;
private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Default;
private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.True_Range;
private anaSuperTrendU11 STU;

//Keltner Universal
private anaKeltnerUniversal KU;

protected override void OnStartUp()


// SuperTrend
STU = anaSuperTrendU11(basePeriod, multiplier, rangePeriod, false, thisBaseType, thisOffsetType, thisVolaType);
// Keltner
KU= anaKeltnerUniversal(20, anaKeltnerMAType.Median, anaKeltnerMAType.SMA, 2, 20, anaKeltnerRangeType.TrueRange, false, 30);



protected override void OnBarUpdate()
// ColorBars
if (EMA(8)[0]> SMA (20)[0]&& STU.UpTrend [0]&& KU.Trend [0]> 0 )
{
BarColor = barColorUp;
CandleOutlineColor = candleOutlineUp;

if (candles && Close[0] > Open[0])
BarColor = Color.FromArgb(opacityUp, BarColor);
}


// Long SetUp
if (KU.Trend [1] <= 0 && KU.Trend [0]>0 && Close [0] > SMA (20) [0]&& STU.UpTrend[0]
|| CrossAbove(EMA (8),SMA (20),1)&& STU.UpTrend[0]&& KU.Trend [0]> 0
|| STU.UpTrend[0]!= STU.UpTrend[1]&& Values[0][0] > Values[1][0]&& KU.Trend [0]> 0)
{
if (Arrows)
DrawArrowUp("arrow"+CurrentBar, true, 0, Open[0]-arrowOffset*TickSize, arrowColorUp);
if (SoundAlert)
Alert("CrossAbove",NinjaTrader.Cbi.Priority.Medium,"CrossAbove",upFile,rearmTime,Color.Navy,Color.Magenta);
}

Thanks again!

Difference between discomfort and pain = 1 tick
Started this thread Reply With Quote
  #7 (permalink)
 
TheWizard's Avatar
 TheWizard 
Houston, TX
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Optimus Futures, AMP, CQG
Trading: 6E
Posts: 1,731 since Jun 2009
Thanks Given: 517
Thanks Received: 4,224


KrazyTrader View Post
Thanks in advance for taking your time to look at this.

First a disclaimer: This is more of a learning experience to improve my coding ability than me being set on a signal.

What i'm curious about... I would like to use the code in //ColorBars to create a signal like I have in //Long SetUp. My thinking is to create something like:
LONG =if (EMA(8)[0]> SMA (20)[0]&& STU.UpTrend [0]&& KU.Trend [0]> 0 )
and then i could use something like--
if LONG [1] == false && LONG [0]==true
{
DrawArrow/ or enter market or something!!
}
I don't know if what I'm asking is possible...but my limited knowledge has me thinking it would simplify/optimize signals and entries.

This is current state:

#region Variables
//SuperTrendU11
private double multiplier = 1.618;
private int rangePeriod = 3;
private int basePeriod = 3;
private anaSuperTrendU11BaseType thisBaseType = anaSuperTrendU11BaseType.Median;
private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Default;
private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.True_Range;
private anaSuperTrendU11 STU;

//Keltner Universal
private anaKeltnerUniversal KU;

protected override void OnStartUp()


// SuperTrend
STU = anaSuperTrendU11(basePeriod, multiplier, rangePeriod, false, thisBaseType, thisOffsetType, thisVolaType);
// Keltner
KU= anaKeltnerUniversal(20, anaKeltnerMAType.Median, anaKeltnerMAType.SMA, 2, 20, anaKeltnerRangeType.TrueRange, false, 30);



protected override void OnBarUpdate()
// ColorBars
if (EMA(8)[0]> SMA (20)[0]&& STU.UpTrend [0]&& KU.Trend [0]> 0 )
{
BarColor = barColorUp;
CandleOutlineColor = candleOutlineUp;

if (candles && Close[0] > Open[0])
BarColor = Color.FromArgb(opacityUp, BarColor);
}


// Long SetUp
if (KU.Trend [1] <= 0 && KU.Trend [0]>0 && Close [0] > SMA (20) [0]&& STU.UpTrend[0]
|| CrossAbove(EMA (8),SMA (20),1)&& STU.UpTrend[0]&& KU.Trend [0]> 0
|| STU.UpTrend[0]!= STU.UpTrend[1]&& Values[0][0] > Values[1][0]&& KU.Trend [0]> 0)
{
if (Arrows)
DrawArrowUp("arrow"+CurrentBar, true, 0, Open[0]-arrowOffset*TickSize, arrowColorUp);
if (SoundAlert)
Alert("CrossAbove",NinjaTrader.Cbi.Priority.Medium,"CrossAbove",upFile,rearmTime,Color.Navy,Color.Magenta);
}

Thanks again!

@KrazyTrader,

It looks like you're on the right track. I don't see anything wrong with the code. You just need to decide what it is you want to do, and under what conditions you want to do it.

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote
Thanked by:
  #8 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9


TheWizard View Post
@KrazyTrader,

It looks like you're on the right track. I don't see anything wrong with the code. You just need to decide what it is you want to do, and under what conditions you want to do it.

That's great!

What i would like to do is:
if (EMA(8)[0]> SMA (20)[0] && STU.UpTrend [0]&& KU.Trend [0]> 0 )
{
DrawArrowUp("arrow"+CurrentBar, true, 0, Open[0]-arrowOffset*TickSize, arrowColorUp);
}
But I don't get 1 arrow up (like a signal) I get an arrow every bar as long as the condition holds. That's the reason I'm using colorbars. I'm trying to get 1 arrow/signal when the conditions becomes true for long and 1 arrow/signal when the condition is short.

Thanks.

Difference between discomfort and pain = 1 tick
Started this thread Reply With Quote
  #9 (permalink)
 
TheWizard's Avatar
 TheWizard 
Houston, TX
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Optimus Futures, AMP, CQG
Trading: 6E
Posts: 1,731 since Jun 2009
Thanks Given: 517
Thanks Received: 4,224


KrazyTrader View Post
That's great!

What i would like to do is:
if (EMA(8)[0]> SMA (20)[0] && STU.UpTrend [0]&& KU.Trend [0]> 0 )
{
DrawArrowUp("arrow"+CurrentBar, true, 0, Open[0]-arrowOffset*TickSize, arrowColorUp);
}
But I don't get 1 arrow up (like a signal) I get an arrow every bar as long as the condition holds. That's the reason I'm using colorbars. I'm trying to get 1 arrow/signal when the conditions becomes true for long and 1 arrow/signal when the condition is short.

Thanks.

@KrazyTrader,

Try adding two bool fields to the Variables section:

private bool uparrowdrawn = false;
private bool downarrowdrawn = false;

Look at it as a "switch" If the light in the room is already on, then don't turn the lightswitch on again. If the light is off, then it's ok to turn the lightswitch on. In your case, your code is telling the indicator to draw the arrow - every time - so long as the condition remains true. You only want to draw it ONCE, so long as the condition remains true - until the condition changes.

Set them both to FALSE in the variables section. We're assuming that both the up and down condition do not exist, to begin with, then add (bolded for emphasis):

if(uparrowdrawn == false) (note the double "=" sign)
{
DrawArrowUp("Up arrow" + CurrentBar, false, 0, Low[0]-arrowoffset*TickSize, arrowColorUp);
uparrowdrawn = true;
downarrowdrawn = false;

}

Each "cycle" thru the code, it will check & see if the (up or down) arrow has already been drawn. If uparrowdrawn / downarrowdrawn is already true, then it won't execute the DrawArrow code again.


and for the down arrow:

if(downarrowdrawn == false) (note the double "=" sign)
{
DrawArrowDown("Down arrow" + CurrentBar, false, 0, High[0]+arrowoffset*TickSize, arrowColorDown);
downarrowdrawn = true;
uparrowdrawn = false;

}

Using the Low[0]-arrowoffset*Ticksize (for the up arrow) and High[0]+arrowoffset*Ticksize (for the down arrow) will displace the drawing of the arrow below the low of the bar, or above the high of the bar, so that the arrow won't be covered by the price bar itself, as it probably would be using Open[0] and Close[0]

Try that & see if it gives you what you want.

p.s. I'm sure there's a more sophisticated way of handling this, but this is the method I've used for years, and it works fine. I'm just a self-trained cut & paste coder myself!

After all, it's what you learn AFTER you know it all, that counts!
Reply With Quote
  #10 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9



TheWizard View Post
@KrazyTrader,

Try adding two bool fields to the Variables section:

private bool uparrowdrawn = false;
private bool downarrowdrawn = false;

Look at it as a "switch" If the light in the room is already on, then don't turn the lightswitch on again. If the light is off, then it's ok to turn the lightswitch on. In your case, your code is telling the indicator to draw the arrow - every time - so long as the condition remains true. You only want to draw it ONCE, so long as the condition remains true - until the condition changes.

Set them both to FALSE in the variables section. We're assuming that both the up and down condition do not exist, to begin with, then add (bolded for emphasis):

if(uparrowdrawn == false) (note the double "=" sign)
{
DrawArrowUp("Up arrow" + CurrentBar, false, 0, Low[0]-arrowoffset*TickSize, arrowColorUp);
uparrowdrawn = true;
downarrowdrawn = false;

}

Each "cycle" thru the code, it will check & see if the (up or down) arrow has already been drawn. If uparrowdrawn / downarrowdrawn is already true, then it won't execute the DrawArrow code again.


and for the down arrow:

if(downarrowdrawn == false) (note the double "=" sign)
{
DrawArrowDown("Down arrow" + CurrentBar, false, 0, High[0]+arrowoffset*TickSize, arrowColorDown);
downarrowdrawn = true;
uparrowdrawn = false;

}

Using the Low[0]-arrowoffset*Ticksize (for the up arrow) and High[0]+arrowoffset*Ticksize (for the down arrow) will displace the drawing of the arrow below the low of the bar, or above the high of the bar, so that the arrow won't be covered by the price bar itself, as it probably would be using Open[0] and Close[0]

Try that & see if it gives you what you want.

p.s. I'm sure there's a more sophisticated way of handling this, but this is the method I've used for years, and it works fine. I'm just a self-trained cut & paste coder myself!

Thanks. I'll check it out and let you know.
p.s. I use the Open [0] -arrowoffset*Ticksize with if(FirstTickOfBar) to determine risk. I wait on a pullback if ArrowUp is above my stop position... enter market if ArrowUp is below my stop position.

Difference between discomfort and pain = 1 tick
Started this thread Reply With Quote




Last Updated on June 1, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts