oldyoungguy
Member
I have two scripts to draw the Blue arrows. I thought they will be the same but they are not. I don't know why?
Option 1:
Now I try to simplify it by removing these if-else and putting the value assigned to MissedBuy into the def statement directly:
Option 2:
from the result you can see, option 1 is better. Because it gives me the signal one bar early. But why option 2 is late?
I have an issue to insert an image here again. so the link is here:
Option 1:
Code:
def MissedBuy ;
if((highTF_redToGreen && (highTF_upTrend or highTF_redWithUpTrend) ))
{
MissedBuy = baseTF_hasCrossAbove ;
}
else if(baseTF_isGreen && highTF_isRed && highTF_mve3dot5 - highTF_mve3dot5[1] > 0.3 )
{
MissedBuy = baseTF_2GreenUp or baseTF_3GreenUp ;
}
else
{
MissedBuy = double.NaN;
}
plot plotMissedBuy = !isNaN(MissedBuy) && isNaN(MissedBuy[1]) && isNaN(MissedBuy[2]) && isNaN(MissedBuy[3])&& isNaN(MissedBuy[4]);
Now I try to simplify it by removing these if-else and putting the value assigned to MissedBuy into the def statement directly:
Option 2:
Code:
def MissedBuy = ((highTF_redToGreen && (highTF_upTrend or highTF_redWithUpTrend) && baseTF_hasCrossAbove ) or
(baseTF_isGreen && highTF_isRed && (highTF_mve3dot5 - highTF_mve3dot5[1] > 0.3) && ( baseTF_2GreenUp or baseTF_3GreenUp)));
plot plotMissedBuy = MissedBuy && !MissedBuy[1] && !MissedBuy[2] && !MissedBuy[3] && !MissedBuy[4];
from the result you can see, option 1 is better. Because it gives me the signal one bar early. But why option 2 is late?
I have an issue to insert an image here again. so the link is here: