Heikin Ashi Strategy (SPY/SH) and inverse chart symbol
Author: nventress23
Creation Date: 2/27/2021 5:39 PM
profile picture

nventress23

#1
Hello WLD Support Team!

I’m in need of some code support from the experts, as I’ve run into 4 items that are probably an easy fix for someone with more experience coding WLD.

Please see my request for some code help in comments (Fully listed at bottom of code //comments.)

#1. I would like to build a simple MA crossover BUY/SELL Algo on the already created Heikin-Ashi bars and SMA.Series(HAbars.Close, 9). With ENTRY/EXIT Bar Annotations.
#2. HAbars(SMA9) MA_Line Dual Plot line Coloring (Just like MA in the other PANES (Up/Down)): (Lines# 363-371)
#3. Correctly address the Annotation of the 200Day High/Low SH bars in the SHPane. (Lines# 138-149)
#4. Create/Address the Bottom I.D. Code for the SH bars in the SHPANE . (Lines# 152-171)
It currently works in the Price Pane only...as I'm not sure how to address the SH bar in the SHPane.
* Not sure, But-If there's a way to make an inverse of the Bottom I.D. code into a TOP I.D. Code (Peaks) that would be useful code to have..

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Hi,

635 lines of code is too much to swallow. Try breaking your request in smaller tasks.
profile picture

nventress23

#3
Hello Eugene,

No problem! - (I was able to answer a few of my own questions from the first post).
Take #2:
The three items/Tasks I’m struggling with and need help are:
#1. Annotation of Buy/Sell Bar in another pane. haPane
1a. Buy - (Line# 226) Annotate Bar in haPane ("BUY")
1b. Sell - (Line# 188) Annotate Bar in haPane ("SELL")

#2. Annotation of the 200Day High/Low SH bars in another pane. SHPane. (Lines# 77-90)

#3. Correctly Address the Bottom I.D. Code for the SH bars in the SHPANE . (Lines# 93-115)

Hopefully by deleting lines that are not relevant, and calling out the specific blocks of code where I need help, it shows up as 3 smaller tasks.

Your assistance in figuring out what I’m missing would be greatly appreciated.
Best Regards,
Nate





CODE:
Please log in to see this code.





profile picture

Eugene

#4
QUOTE:
1a. Buy - (Line# 226) Annotate Bar in haPane ("BUY")
...
#2. Annotation of the 200Day High/Low SH bars in another pane. SHPane. (Lines# 77-90)


AnnotateBar isn't supposed to work in arbitrary ChartPanes. You can choose between AnnotateChart or DrawText depending on the purpose to implement your own logic.
profile picture

nventress23

#5
Thank you Eugene !
- I was able to annotate the signal(s) using the (AnnotateChart(haPane, "BUY", bar, Close[bar], Color.White, Color.Transparent, font)


I'm still puzzled how to get the Bottom Code to work on the "SH" bars and DrawCircle at Bottom in the SHPane?? Any help on that one would be greatly appreciated. I attached the basic code I'm working with that currently does not work correctly. (LInes 69-84)



Best Regards,
Nate

CODE:
Please log in to see this code.
profile picture

Eugene

#6
Hi Nate,
QUOTE:
I'm still puzzled how to get the Bottom Code to work on the "SH" bars and DrawCircle at Bottom in the SHPane??

From what I see, DrawCircle works in the SHPane but for that to happen, the instrument's prices should be in a similar range i.e. $17-30 in 2020-2021. Maybe it's a bug, haven't digged into this deep enough to tell for sure.
profile picture

nventress23

#7

(SH/SH) DrawCircle works in both Panes: when. SH is selected as the Symbol & Inverse Get Symbol “SH’
(SPY/SH) When Symbol is SPY and Inverse Get Symbol “SH” the SHPane – Draw Circle does not seem to work…?

So..some how I figured there was a relationship in the current code between having the selected symbol as something different than the get symbol "SH" code for SHPane? I would think that the (Bars SH = GetExternalSymbol("SH", true) would not care what the selected symbol in the PricePane would be for the code to keep working on the SH symbol in the SHPane...?


** SOLVED **
- Found it... Low vs.SH.Low in SHPane code...


Solved -3-4-2021 SPY_SH BottomDrawCircle.png




profile picture

Eugene

#8
Glad to see you've figured out the source of error!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).