Simple Coding Help - No Promise.

trash

Well-Known Member
@ Happy singh ji.

i tried it....
is it ok now....?

Buy =H < EMA(C, 3) ;
Sell = L > EMA(C, 3);
Filter = Buy OR Sell ;

AddColumn( IIf(Buy==1,BuyPrice,Null), "buy" );
AddColumn( IIf(Sell==1,SellPrice,Null), "sell"

Code:
EMAdelay = 1;
Buy = H < Ref( EMA( C, 3 ), -EMAdelay );
Sell = L > Ref( EMA( C, 3 ), -EMAdelay );

// remove excessive signals
//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );

Filter = Buy OR Sell;

format = 1.2;
AddColumn( IIf( Buy, BuyPrice, Null ), "buy", format );
AddColumn( IIf( Sell, SellPrice, Null ), "sell", format );
 
Code:
EMAdelay = 1;
Buy = H < Ref( EMA( C, 3 ), -EMAdelay );
Sell = L > Ref( EMA( C, 3 ), -EMAdelay );

// remove excessive signals
//Buy = ExRem( Buy, Sell );
//Sell = ExRem( Sell, Buy );

Filter = Buy OR Sell;

format = 1.2;
AddColumn( IIf( Buy, BuyPrice, Null ), "buy", format );
AddColumn( IIf( Sell, SellPrice, Null ), "sell", format );


Thanx you trash for ur help..

code posted by you bit differ my requirement..


I want candles not touching 3EMA might be in uptrend or downtrend...
When i tried to explore,it is showing candles which are touching 3ema..

for help..

pls watch this attachment
(Marking done with "Watch this red candle " on chart)

if u watch the chart of nifty.. candle is far away from 3ema..

i wish to just explore such stocks.

Thanx you
 
Last edited:

extremist

Well-Known Member
so....
the finished version would be like this i guess!


periods = Param( "Periods", 3, 1, 200, 1 );
EMAdelay = Param( "Delay", 1, 0, 200, 1 );
Buy = H < Ref( EMA( C, periods ), -EMAdelay );
Sell = L > Ref( EMA( C, periods ), -EMAdelay );

if( ParamToggle("Plot EMA", "No|Yes", 1))
Plot(EMA(C,periods),"EMA "+periods ,colorYellow,1,0,0,0,1);

PlotShapes(IIf(Buy, shapeSmallUpTriangle, shapeNone),colorBrightGreen, 0,C);
PlotShapes(IIf(Sell, shapeSmallDownTriangle, shapeNone),colorRed, 0,C);

Filter = Buy OR Sell ;

AddColumn( IIf(Buy==1,BuyPrice,Null), "buy" );
AddColumn( IIf(Sell==1,SellPrice,Null), "sell" );
 
so....
the finished version would be like this i guess!


periods = Param( "Periods", 3, 1, 200, 1 );
EMAdelay = Param( "Delay", 1, 0, 200, 1 );
Buy = H < Ref( EMA( C, periods ), -EMAdelay );
Sell = L > Ref( EMA( C, periods ), -EMAdelay );

if( ParamToggle("Plot EMA", "No|Yes", 1))
Plot(EMA(C,periods),"EMA "+periods ,colorYellow,1,0,0,0,1);

PlotShapes(IIf(Buy, shapeSmallUpTriangle, shapeNone),colorBrightGreen, 0,C);
PlotShapes(IIf(Sell, shapeSmallDownTriangle, shapeNone),colorRed, 0,C);

Filter = Buy OR Sell ;

AddColumn( IIf(Buy==1,BuyPrice,Null), "buy" );
AddColumn( IIf(Sell==1,SellPrice,Null), "sell" );
Thanks exm for the complete code . . .

This logic is used on SH315 system to scale-out . . . so the sell / buy shapes can be reversed :)

PlotShapes(IIf(Sell, shapeSmallUpTriangle, shapeNone),colorBrightGreen, 0,L); // Shows Over Sold condition
PlotShapes(IIf(Buy, shapeSmallDownTriangle, shapeNone),colorRed, 0,H); // Shows Over Bought condition


Happy :)
 

Nehal_s143

Well-Known Member
Please Guide :

1) How to change Amibroker's basic window background to grey? I know how to change chart background but don't know about Amibroker's basic background that we can notice when we hide the chart or resize it or which appears when we have not loaded any chart.

2) How to get only TILE ? I dont want vertical tile or horizontal. ONLY TILE ?

3) How to get bar chart as default ? I have to change again and again from toolbar>view>price chart style. I want to change it permanently to bar chart- like whenever i run amibroker it should display only bar chart.
I think you are using trail version, hence setting not getting saved.
 
so....
the finished version would be like this i guess!


periods = Param( "Periods", 3, 1, 200, 1 );
EMAdelay = Param( "Delay", 1, 0, 200, 1 );
Buy = H < Ref( EMA( C, periods ), -EMAdelay );
Sell = L > Ref( EMA( C, periods ), -EMAdelay );

if( ParamToggle("Plot EMA", "No|Yes", 1))
Plot(EMA(C,periods),"EMA "+periods ,colorYellow,1,0,0,0,1);

PlotShapes(IIf(Buy, shapeSmallUpTriangle, shapeNone),colorBrightGreen, 0,C);
PlotShapes(IIf(Sell, shapeSmallDownTriangle, shapeNone),colorRed, 0,C);

Filter = Buy OR Sell ;

AddColumn( IIf(Buy==1,BuyPrice,Null), "buy" );
AddColumn( IIf(Sell==1,SellPrice,Null), "sell" );



hello happy ji, extremist ji n trash ji...

it is now also showing stocks which are touching 3EMA..

(yet not able to find the correct code)

I want Stocks which are not touching 3EMA
(TAIL SHOULD NOT TOUCH 3EMA - Need only those stocks)

But it is showing all which are touching 3EMA..

Please scan N check...


Thanx you...
 

pratapvb

Well-Known Member
hello happy ji, extremist ji n trash ji...

it is now also showing stocks which are touching 3EMA..

(yet not able to find the correct code)

I want Stocks which are not touching 3EMA
(TAIL SHOULD NOT TOUCH 3EMA - Need only those stocks)

But it is showing all which are touching 3EMA..

Please scan N check...


Thanx you...
EMAdelay = Param( "Delay", 1, 0, 200, 1 );

emadelay is still default 1 in your code....either make the default 0 (zero) or change it using Parameters in the auto analuzis dialog before scan/explore
 

extremist

Well-Known Member
@ Shruti

probably this wht u r looking for.

periods = Param( "Periods", 3, 1, 200, 1 );
EMAdelay = Param( "Delay", 0, 0, 200, 1 );
Buy = L > Ref( EMA( C, periods ), -EMAdelay );
Sell = H < Ref( EMA( C, periods ), -EMAdelay );

Plot(EMA(C,periods),"EMA "+periods ,colorYellow,1,0,0,0,1);
PlotShapes(IIf(Sell, shapeSmallCircle, shapeNone),colorPaleGreen, 0,H);
PlotShapes(IIf(Buy , shapeSmallCircle, shapeNone),colorOrange, 0,L);



**********************************

some instructions for the use of code

1. if ur using the code as it is then it's fine.

2. though if u find uncomfortable with the current candle coz some time u will notice tht this thing is repainting then u may increase the delay to 1 or to the comfort of urs.

3. and if u increase the period of the ema then u will notice tht it is giving the exactly opposite sig as u would have liked to be seen.

so in tht case

just change following lines

PlotShapes(IIf(Sell, shapeSmallCircle, shapeNone),colorPaleGreen, 0,H);
PlotShapes(IIf(Buy , shapeSmallCircle, shapeNone),colorOrange, 0,L);

to

PlotShapes(IIf(Buy , shapeSmallCircle, shapeNone),colorPaleGreen, 0,H);
PlotShapes(IIf(Sell , shapeSmallCircle, shapeNone),colorOrange, 0,L);
 

Similar threads