Jump to content
Medved Trader Forums

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.

Link to comment
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...

Link to comment
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

Link to comment
Share on other sites

  • 2 weeks later...

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?

Link to comment
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
Link to comment
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");
}

Link to comment
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
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...