Friends, Please help me.

#1
Hi guys! can anybody help me?
I want to write a module to explore stocks under cirtain conditions,
A) IF PRICE OF STOCK IS IN THE RANGE OF RS.50.00 TO 250.00

1) buy = sma 5 - sma 25 > 2.00, (i.E. DIFFERENCE IN SMA SHOULD BE GREATER THAN 2.00) and sma 5 is crossing above the sma 25,
2) SELL = sma 25 - sma 5 = 2.00, and 25 is crossing above the sma 5,

B) IF PRICE IS > 250 < 500 DIFFERENCE SMA SHOULD BE > 4.50,
C) IF PRICE IS > 500 < 800 DIFFERENCE SMA SHOULD BE > 7.00,
D) IF PRICE IS >800 < 1100 DIFFERENCE SMA SHOULD BE > 10.00,


Short = Cross(SMA (C,15), SMA (C,5));
Cover = Cross (SMA (C,5), SMA (C,15));

I have tried to write a module but i could not complete it and i think it is following only only one condition not the other one. pls. somebody correct this.

Cond1=Cross( SMA (C, 5 ) , SMA (C, 25 ));
Cond2= (SMA (C, 5 ) - SMA ( C,25 ) > 10 );

Cond3=Cross( SMA ( C, 25 ) , SMA ( C, 5 ));
Cond4=( SMA (C, 25 ) - SMA ( C, 5 ) > 10 );
D1= SMA(C,5) - SMA(C, 25);
D2= SMA(C,25) - SMA (C,5);
Buy = Cond1 + Cond2;
Sell= Cond3 + Cond4;
Short = Cross(SMA (C,15), SMA (C,5));
Cover = Cross (SMA (C,5), SMA (C,15));

Filter= (Close > 800.00 < 1100.00);
Filter=Buy;
Filter=Sell;
Filter =Short;
Filter=Cover;

AddColumn( Close, "Close", 1.2 );
AddColumn( D1,"Buy MAD", 1.4 );
AddColumn( D2,"Sell MAD", 1.4 );

AddColumn( Cond1+Cond2, "BUY", 0 );
AddColumn( Cond3+Cond4, "SELL", 0 );
AddColumn(Short,"coverBuy",1.2);
AddColumn(Cover,"coverSell",1.2);

suggetions are most wellcome!
Please, Please, Please, Please.......... help me out to complete the task.
 

mastermind007

Well-Known Member
#3
Hi guys! can anybody help me?
I want to write a module to explore stocks under cirtain conditions,
A) IF PRICE OF STOCK IS IN THE RANGE OF RS.50.00 TO 250.00

1) buy = sma 5 - sma 25 > 2.00, (i.E. DIFFERENCE IN SMA SHOULD BE GREATER THAN 2.00) and sma 5 is crossing above the sma 25,
2) SELL = sma 25 - sma 5 = 2.00, and 25 is crossing above the sma 5,

B) IF PRICE IS > 250 < 500 DIFFERENCE SMA SHOULD BE > 4.50,
C) IF PRICE IS > 500 < 800 DIFFERENCE SMA SHOULD BE > 7.00,
D) IF PRICE IS >800 < 1100 DIFFERENCE SMA SHOULD BE > 10.00,


Short = Cross(SMA (C,15), SMA (C,5));
Cover = Cross (SMA (C,5), SMA (C,15));

I have tried to write a module but i could not complete it and i think it is following only only one condition not the other one. pls. somebody correct this.

Cond1=Cross( SMA (C, 5 ) , SMA (C, 25 ));
Cond2= (SMA (C, 5 ) - SMA ( C,25 ) > 10 );

Cond3=Cross( SMA ( C, 25 ) , SMA ( C, 5 ));
Cond4=( SMA (C, 25 ) - SMA ( C, 5 ) > 10 );
D1= SMA(C,5) - SMA(C, 25);
D2= SMA(C,25) - SMA (C,5);
Buy = Cond1 + Cond2;
Sell= Cond3 + Cond4;
Short = Cross(SMA (C,15), SMA (C,5));
Cover = Cross (SMA (C,5), SMA (C,15));

Filter= (Close > 800.00 < 1100.00);
Filter=Buy;
Filter=Sell;
Filter =Short;
Filter=Cover;

AddColumn( Close, "Close", 1.2 );
AddColumn( D1,"Buy MAD", 1.4 );
AddColumn( D2,"Sell MAD", 1.4 );

AddColumn( Cond1+Cond2, "BUY", 0 );
AddColumn( Cond3+Cond4, "SELL", 0 );
AddColumn(Short,"coverBuy",1.2);
AddColumn(Cover,"coverSell",1.2);

suggetions are most wellcome!
Please, Please, Please, Please.......... help me out to complete the task.

Code:
//http://www.traderji.com/introductions/97882-friends-please-help-me.html#post1055871
//written by mastermind007
sma5 = MA(C,5);
sma25 = MA(C,25);
Plot(C, "Close", colorBlack, styleCandle);
Plot(sma5, "sma5", colorBlue, styleLine);
Plot(sma25, "sma25", colorRed, styleLine);
gap = IIf(C < 250, 2, IIf(C < 500, 4.5, IIf(C < 800, 7, IIf(C < 1100, 10, 20))));
Buy   = ((sma5  > sma25) AND ((sma5  - sma25) > gap));
Short = ((sma25 > sma5)  AND ((sma25 - sma5)  > gap));

Cover = Buy   = ExRem(Buy  , Short);
Sell  = Short = ExRem(Short, Buy  );

PlotShapes(Buy * shapeUpArrow + Sell * shapeDownArrow, colorRed);

Filter = Buy or Sell or Short or Cover;

AddColumn( Close, "Close", 1.2 );
..... 
....
....
 

Similar threads