Jump to content
Medved Trader Forums
Soundwave401

Heiken Ashi Red to Green Scan Help

Recommended Posts

Hello,

Trying to create a scan on the historical daily charts using the Heiken Ashi candles. I know there is a checkbox on the scanner to make it utilize HA. But what I want to scan for is a long line of HA candles in a row and today there is a green. This would be a scan I'd run EOD. Because Heiken Ashi isn't a selectable variable in the basic scanner options I'm not sure how I would go about accomplishing this. If I have HA selected in the scan checkbox how could I get the scanner to pick up on a long succession of red HA candles and then a switch to green today? Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

I am not sure what you mean by "Heiken Ashi is not available in basic scanner options"...

If you check that box in the scanner options, then the values for the candles that the scan receives will be for HA candles. If you don't, those values will be for regular candles.

Do you mean you want to mix HA with regular candles? See past candles as HA but the current one as regular? If so - no, that cannot be done. I mean, maybe it could be done if you write the code in the scanner (advanced scanner) to build the last candle yourself...

Share this post


Link to post
Share on other sites

I see. No I don't want to mix HA with regular. I want to create a scan I can run EOD after close on a portfolio that has about 1500 symbols. What I a want to scan for is a stock that had at least 4-5 red HA candles in a row and today had a green. I know this can probably be done quite simply but I am having a hell of a time accomplishing it ?

The screenshot attached shows what I am trying to accomplish. Please forgive my primitive Paint skills

Baba.jpg

Share this post


Link to post
Share on other sites

Ok well, that can definitely be done, even using a simple scan editor.

This is for 5 red candles followed by a green one (don't forget to set the HA checkbox if you want this done on HA candles)

 

image.png

Share this post


Link to post
Share on other sites

Awesome thanks!

Now is it possible to combine this same logic both ways in the same paintbar for an intraday scan? So say I want to play it for daytrading calls and puts on 5 min charts with HA. I want it to also alert when 5 or more green candles happen in a row and then a red so I could play a put. I've  tried combining them together in the simple editor and it seems like I'd need some sort of command to break in between. My only solution is to have  two identical portfolios open running opposite scans. But that uses alot of computer resources. Can they be combined?

Share this post


Link to post
Share on other sites

To combine, you would have to switch to advanced mode.

 

if (Close[5]<Open[5] && Close[4]<Open[4] && Close[3]<Open[3] && Close[2]<Open[2] && Close[1]<Open[1] && Close>Open)
{
   SetScanResult("Green after 4 reds");
}
else if (Close[5]>Open[5] && Close[4]>Open[4] && Close[3]>Open[3] && Close[2]>Open[2] && Close[1]>Open[1] && Close<Open)
{
   SetScanResult("Red after 4 greens");
}

  • Thanks 1

Share this post


Link to post
Share on other sites

One last question.. I promise. If I wanted to take that code you posted above and mesh it together with these indicators from another paintbar is that possible? I tried it myself but I am getting {} imbalance errors. Or am I asking too much of one scan?

 

// Var Name: "ADX_PlusDMI" contains ADX(8,10).PlusDMI
// Var Name: "ADX_MinusDMI" contains ADX(8,10).MinusDMI
// Var Name: "FULLST_Line" contains Full Stochastic(14,3,7).Line
// Var Name: "FULLST_Signal" contains Full Stochastic(14,3,7).Signal
// Var Name: "MACD_Main" contains MACD(12,26,9).Main
// Var Name: "MACD_Signal" contains MACD(12,26,9).Signal

public void MainCalculation()
{
    if (ADX_PlusDMI.CrossesDown(ADX_MinusDMI, 0))
    {
        SetColorAndShape(SysColor.MainIndicator3, PBShape.X);
        TriggerAlert("ADX DOWN");
        SetScanResult("0 ADX");
    }
    if (FULLST_Line.CrossesDown(FULLST_Signal, 0))
    {
        SetColorAndShape(SysColor.MainIndicator6, PBShape.S);
        SetScanResult("1 -Stoch");
    }
    if (MACD_Main.CrossesDown(MACD_Signal, 0))
    {
        SetColorAndShape(0xFFFF0A0A, PBShape.M);
        SetScanResult("2 -MACD");
    }
    if (ADX_PlusDMI.CrossesUp(ADX_MinusDMI, 0))
    {
        SetColorAndShape(SysColor.MainIndicator2, PBShape.X);
        TriggerAlert("ADX UP");
        SetScanResult("3 ADX");
    }
    if (FULLST_Line.CrossesUp(FULLST_Signal, 0))
    {
        SetColorAndShape(SysColor.MainIndicator11, PBShape.S);
        SetScanResult("4 Stoch");
    }
    if (MACD_Main.CrossesUp(MACD_Signal, 0))
    {
        SetColorAndShape(SysColor.MainIndicator2, PBShape.M);
        SetScanResult("5 MACD");
    }

}

if (Close[5]<Open[5] && Close[4]<Open[4] && Close[3]<Open[3] && Close[2]<Open[2] && Close[1]<Open[1] && Close>Open)
{
   SetScanResult("Green after 4 reds");
}
else if (Close[5]>Open[5] && Close[4]>Open[4] && Close[3]>Open[3] && Close[2]>Open[2] && Close[1]>Open[1] && Close<Open)
{
   SetScanResult("Red after 4 greens");
}

Share this post


Link to post
Share on other sites

you have to have an } at the end to close the MainCalculation function.

 

Another thing - any SetScanResult overrides the previous one. So you either list them in the descending order of importance or in ascending order of importance, but then add a "return;" right after each.

 

And don't promise this is the last question :) Questions are good, especially on forums where other people may be helped by the discussion.

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×