Jump to content

use PlotColors[0][0] as strategy trigger


microsat2

Recommended Posts

A SMAColors indicator has three lines color.

If (Rising(SMAColors(14))

PlotColors[0][0] = Color.Blue;

else if (Falling(SMAColors(14))

PlotColors[0][0] = Color.Red;

else

PlotColors[0][0] = Color.Yewllow;

 

My question is "can we use the PlotColors to trigger short or long trade in a strategy?"

Like

 

if (SMAColors(14).PlotColors[0][0] == Color.Red)

EnterShort();

Link to comment
Share on other sites

A SMAColors indicator has three lines color.

If (Rising(SMAColors(14))

PlotColors[0][0] = Color.Blue;

else if (Falling(SMAColors(14))

PlotColors[0][0] = Color.Red;

else

PlotColors[0][0] = Color.Yewllow;

 

My question is "can we use the PlotColors to trigger short or long trade in a strategy?"

Like

 

if (SMAColors(14).PlotColors[0][0] == Color.Red)

EnterShort();

 

Declare a int in the variables section "private int signal = 0;"

 

If (Rising(SMAColors(14))

{

PlotColors[0][0] = Color.Blue;

signal = 1;

}

else if (Falling(SMAColors(14))

{

PlotColors[0][0] = Color.Red;

signal = 2;

}

else

{

PlotColors[0][0] = Color.Yewllow;

signal = 0;

}

 

if (signal == 2)

EnterShort();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...