Good evening!
I tried to optimize different bull variables of HeikinAshi, but I am obviously doing it wrong. My logic was to define each indicator with a number; 1016-1020 and then labelling them as aa-ff in the optimization tool. Thanks in advance!
//Definitions of different BullHeikinAshi
BullishHaramiCross=1016
BullishCounterAttack=1017
BullishBreakaway=1018
GapUp=1018
InvertedHammer=1019
TweezersTop=1020
//Bullish Signal Heikin Ashi
BullishBreakaway=(body[4]<0 and body[3]<0 and body>0 and open[3]<close[4] and close[2]<close[3] and close[1]<close[2] and longcandle and close<close[4] and close>open[3]) and TrendDown[5]
BullishCounterAttack=(body[1]<0 and longcandle[1] and body>0 and longcandle and close<=close[1]) and TrendDown[2]
BullishHaramiCross=(body[1]<0 and longcandle[1] and bodybottom>bodybottom[1] and bodytop<bodytop[1] and ratio<0.3 and range<0.3*range[1]) and TrendDown[2]
GapUp=(low>high[1])
InvertedHammer=(body[1]<0 and longcandle[1] and low<low[1] and shadowtop>2*abody and shadowbottom<0.3*abody)and TrendDown[2]
TweezersTop=(body[1]>0 AND longcandle[1] AND body<=0 AND high=high[1]) and TrendUp[2]
BullHeikinAshi=aa or bb or cc or dd or ee or ff
Why didn’t you do below?
//Definitions of different BullHeikinAshi
BullishHaramiCross=aa
BullishCounterAttack=bb
BullishBreakaway=cc
GapUp=dd
InvertedHammer=ee
TweezersTop=ff
Thanks GraHal, but the optimization is done in numbers. Doing the optimization could exclude several BullHeikinAshi as aa-ff could end up in just being one or two of the variables.
Optimization example: aa=1017, bb=1017, cc=1018, dd=1018, ee=1018, ff=1017.
Conclusion: only use BullishCounterAttack (1017) and BullishBreakaway (1018) in the statement.
So with BullishHaramiCross=aa then optimised result could be ….
BullishHaramiCross = 1016
or
BullishHaramiCross = 1017
or
BullishHaramiCross = 1018
or
BullishHaramiCross = 1019
or
BullishHaramiCross = 1020
Thanks GraHal, but I am sorry, I do not see how that would help me sorting out possible variables?
I’ve just seen below
BullHeikinAshi=aa or bb or cc or dd or ee or ff
So I’d have coded
BHC = BullishHaramiCross=aa
BCA = BullishCounterAttack=bb
BB = BullishBreakaway=cc
GU = GapUp=dd
IH = InvertedHammer=ee
TT= TweezersTop=ff
BullHeikinAshi = BHC or BCA or BB or GU or IH or TT
Maybe I’m reading your problem all wrong?? 🙂 Vonasi or Roberto … help?? 🙂
Now I look at and have read all your code I don’t see how – for example – you can optimise below in the way I suggest, apologies! 🙂
BullishHaramiCross=(body[1]<0 and longcandle[1] and bodybottom>bodybottom[1]
Maybe best if Vonaso or Roberto delete my posts and I stop watching TV at the same time I make comments on here!? 🙂
No worries GraHal, I am thankful that you are responding so quickly on a Sunday evening when you should watch TV 🙂
My statement is probably so absurd that it was difficult to grasp. Anyhow, let’s see how it evolves tomorrow. TV suggestions: Vis a vis on Netflix and Quarry on HBO 🙂
Not to forget Toc Toc on Netflix.
You could test this way of adding the boolean condition in the same variable:
if aa = 1016 then
BullHeikinAshi=bullheikinashi and BullishHaramiCross
elsif aa = 1017 then
BullHeikinAshi=bullheikinashi and BullishCounterAttack
elsif aa = 1018 then
// .. and so on ..
Do the same for bb,cc,…
(not tested)
Good morning Nicolas and thank you very much.
Your suggestion seems logical and I will try that approach. After testing I will confirm and include the partial code, THANKS!
Dear Nicolas, I just want to confirm that your suggestion worked very well. I enclose the code:
//Definitions of BullHeikinAshi
if aa = 1016 then
aaa=BullishHaramiCross
elsif aa = 1017 then
aaa=BullishCounterAttack
elsif aa = 1018 then
aaa=BullishBreakaway
elsif aa = 1019 then
aaa=GapUp
elsif aa = 1020 then
aaa=InvertedHammer
elsif aa = 1021 then
aaa=TweezersTop
elsif bb = 1016 then
bbb=BullishHaramiCross
elsif bb = 1017 then
bbb=BullishCounterAttack
elsif bb = 1018 then
bbb=BullishBreakaway
elsif bb = 1019 then
bbb=GapUp
elsif bb = 1020 then
bbb=InvertedHammer
elsif bb = 1021 then
bbb=TweezersTop
elsif cc = 1016 then
ccc=BullishHaramiCross
elsif cc = 1017 then
ccc=BullishCounterAttack
elsif cc = 1018 then
ccc=BullishBreakaway
elsif cc = 1019 then
ccc=GapUp
elsif cc = 1020 then
ccc=InvertedHammer
elsif cc = 1021 then
ccc=TweezersTop
elsif dd = 1016 then
ddd=BullishHaramiCross
elsif dd = 1017 then
ddd=BullishCounterAttack
elsif dd = 1018 then
ddd=BullishBreakaway
elsif dd = 1019 then
ddd=GapUp
elsif dd = 1020 then
ddd=InvertedHammer
elsif dd = 1021 then
ddd=TweezersTop
elsif ee = 1016 then
eee=BullishHaramiCross
elsif ee = 1017 then
eee=BullishCounterAttack
elsif ee = 1018 then
eee=BullishBreakaway
elsif ee = 1019 then
eee=GapUp
elsif ee = 1020 then
eee=InvertedHammer
elsif ee = 1021 then
eee=TweezersTop
endif
BullHeikinAshi=aaa or bbb or ccc or ddd or eee
Having 5 alternatives was a bit too many. 3 seems to be well enough. By the optimization, I can filter out what factors that likely work best within a specific time frame and stock.