[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Buying and Selling with AND/OR



PureBytes Links

Trading Reference Links

I have 3 indicators and I'm trying to find the best way to code 
this. I want to initiate a buy when 2 or 3 of the 3 indicators are 
bullish and a sell when 2 or 3 of the 3 indicators are bearish. When 
I run it with the code I have, I'm believe i'm getting incorrect 
data. Can someone tell me what i'm doing wrong?

My Idea:
X(BEARISH OR BULLISH);
Y(BEARISH OR BULLISH);
Z(BEARISH OR BULLISH);
BUY = (X=BULLISH AND Y=BULLISH) OR (X=BULLISH AND Z=BULLISH) OR 
(Y=BULLISH AND Z=BULLISH);
SELL = (X=BEARISH AND Y=BEARISH) OR (X=BEARISH AND Z=BEARISH) OR 
(Y=BEARISH AND Z=BEARISH);
Cover == Buy;
Short == Sell;


My Code So Far:
// for fast stochastic
fsk=100*((Close-LLV(Low, 14))/(HHV(High,14)-LLV(Low,14)));
fsd=MA(100*((Close-LLV(Low, 14))/(HHV(High,14)-LLV(Low,14))),3);

Buy = StochK()>StochD() AND StochK(9)>StochD(9) OR StochK()>StochD() 
AND fsk>fsd OR StochK(9)>StochD(9) AND fsk>fsd;
Sell = StochK()<StochD() AND StochK(9)<StochD(9) OR StochK()<StochD() 
AND fsk<fsd OR StochK(9)<StochD(9) AND fsk<fsd;
Cover = StochK()>StochD() AND StochK(9)>StochD(9) OR StochK()>StochD
() AND fsk>fsd OR StochK(9)>StochD(9) AND fsk>fsd;
Short = StochK()<StochD() AND StochK(9)<StochD(9) OR StochK()<StochD
() AND fsk<fsd OR StochK(9)<StochD(9) AND fsk<fsd;

TIA
Nathan