Simple Coding Help - No Promise.

vijkris

Learner and Follower
Vijay Krishna Sir,
Will you please post the AFL for Stochastic Ossilator as per Smart Trade Thread “How to trade with an Ossilator”
Thanks in advance
PriyaRamesh
hi,
sorry I don have the afl.
thanks
regards
 

nitingosavi

Well-Known Member
I have two little queries.

1.How we can set conditional price chart background colour.

any condition. for example

suppose if RSI(5) > RSI(15) . I want background colour pale yellow
and if RSI(5)<RSI(15). I want rose coloured background.

means according to applied condition, I will get vertical stripes background of pale yellow/rose colour.

I tried this but it changing whole background colour when a condition triggers.

2. In a indicator pane how can we set coloured zones in background non conditional.
for example

ADX pane

if I want 0 to 10 no fill
10 to 15 pale green fill
15 to 20 no colour fill
20 to 25 pale green fill
25 to 40 rose colour fill

how to set it ? I don't want indicator to change colour, just fixed background colour zones.

Can any one help ?
 

vijkris

Learner and Follower
I have two little queries.

1.How we can set conditional price chart background colour.

any condition. for example

suppose if RSI(5) > RSI(15) . I want background colour pale yellow
and if RSI(5)<RSI(15). I want rose coloured background.

means according to applied condition, I will get vertical stripes background of pale yellow/rose colour.

I tried this but it changing whole background colour when a condition triggers.

2. In a indicator pane how can we set coloured zones in background non conditional.
for example

ADX pane

if I want 0 to 10 no fill
10 to 15 pale green fill
15 to 20 no colour fill
20 to 25 pale green fill
25 to 40 rose colour fill

how to set it ? I don't want indicator to change colour, just fixed background colour zones.

Can any one help ?
hi,regarding 2nd query, wil u be interested in ribbon in adx pane.
similar to this?


regarding background color change , I have no idea..:(
 

nitingosavi

Well-Known Member
hi,regarding 2nd query, wil u be interested in ribbon in adx pane.
similar to this?


regarding background color change , I have no idea..:(
No not ribbon.

I need diff background colours between 10 to 15, 15 to 20, 20 to 25, 25 to 40
those will be horizontal stripes of above specified width filled with diff colours.
let ADX condition can be anything. colours are fixed.
 
Thanks a lot.

but some how atop is not working properly.

my condition is to buy when RSI oversold and sell when RSI is overbought. it gives good results but in trending market when RSI remains Overbought and oversold if price goes below low of my buy candle or certain % of my buy price i want to exit with small loss.
but this should be fix SL.
is there any way out??
 
hi,
applystop will work only if ur stop is at a distance from buyprice, u can trail it though.
if u want to exit when price close below buyprice, u can try below logic, but the biggest disadvantage is there is no room for movement of price and stop may hit immediately after entry.
I think u need to put better exit criteria.
just for eg.
Buy = Cross(C,MA(C,10);
BuyPrice = ValueWhen(Buy,H);// this is the buyprice
Sell = "ur target " OR Cross(BuyPrice,C);

regards
Thanks a lot.

but some how atop is not working properly.

my condition is to buy when RSI oversold and sell when RSI is overbought. it gives good results but in trending market when RSI remains Overbought and oversold if price goes below low of my buy candle or certain % of my buy price i want to exit with small loss.
but this should be fix SL.
is there any way out??
 
Dear Friends

I need expert advisor to the following code, it is very good in 15min time frame for index scripts, kinly help if anybody

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
//#include_once <popup.afl>

_SECTION_BEGIN("SuperTrend Ver 2 with Sound and Popup Alert");

SetBarsRequired(100000,0);

GraphXSpace = 15;

SetChartOptions(0,chartShowArrows|chartShowDates);

SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));

GfxSetBkMode(0);

GfxSetOverlayMode(1);

SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(C<=O,ParamColor("Candle Down Color", colorRed),colorLightGrey)));

Plot(C,"\nPrice",IIf(C>O,ParamColor("Wick UP Color", colorDarkGreen),IIf(C<=O,ParamColor("Wick Down Color", colorDarkRed),colorLightGrey)),64,0,0,0,0);



//SetTradeDelays(1,1,1,1);

SetPositionSize(100,spsShares);





_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));



Factor=Param("Factor",3,1,10,0.1);

Pd=Param("ATR Periods",7,1,150,1);


Up=(H+L)/2+(Factor*ATR(Pd));

Dn=(H+L)/2-(Factor*ATR(Pd));

iATR=ATR(Pd);

TrendUp=TrendDown=Null;

trend[0]=1;

changeOfTrend=0;

flag=flagh=0;



for (i = 1; i <BarCount-1; i++) {

TrendUp = Null;

TrendDown = Null;



trend=1;





if (Close>Up[i-1]) {

trend=1;

if (trend[i-1] == -1) changeOfTrend = 1;



}

else if (Close<Dn[i-1]) {

trend=-1;

if (trend[i-1] == 1) changeOfTrend = 1;

}

else if (trend[i-1]==1) {

trend=1;

changeOfTrend = 0;

}

else if (trend[i-1]==-1) {

trend=-1;

changeOfTrend = 0;

}



if (trend<0 && trend[i-1]>0) {

flag=1;

}

else {

flag=0;

}



if (trend>0 && trend[i-1]<0) {

flagh=1;

}

else {

flagh=0;

}



if (trend>0 && Dn<Dn[i-1]){

Dn=Dn[i-1];

}



if (trend<0 && Up>Up[i-1])

{ Up=Up[i-1];

}



if (flag==1)

{ Up=(H+L)/2+(Factor*iATR);;

}

if (flagh==1)

{ Dn=(H+L)/2-(Factor*iATR);;

}

if (trend==1) {

TrendUp=Dn;

if (changeOfTrend == 1) {

TrendUp[i-1] = TrendDown[i-1];

changeOfTrend = 0;

}

}

else if (trend==-1) {

TrendDown=Up;

if (changeOfTrend == 1) {

TrendDown[i-1] = TrendUp[i-1];

changeOfTrend = 0;

}

}

}



Plot(TrendUp,"Trend",colorGreen);

Plot(TrendDown,"Down",colorRed);



Buy = trend==1;

Sell=trend==-1;



Buy=ExRem(Buy,Sell);

Sell=ExRem(Sell,Buy);

Short=Sell;

Cover=Buy;





BuyPrice=ValueWhen(Buy,C);

SellPrice=ValueWhen(Sell,C);

ShortPrice=ValueWhen(Short,C);

CoverPrice=ValueWhen(Cover,C);
 

amitrandive

Well-Known Member
I have two little queries.

1.How we can set conditional price chart background colour.

any condition. for example

suppose if RSI(5) > RSI(15) . I want background colour pale yellow
and if RSI(5)<RSI(15). I want rose coloured background.

means according to applied condition, I will get vertical stripes background of pale yellow/rose colour.

I tried this but it changing whole background colour when a condition triggers.

2. In a indicator pane how can we set coloured zones in background non conditional.
for example

ADX pane

if I want 0 to 10 no fill
10 to 15 pale green fill
15 to 20 no colour fill
20 to 25 pale green fill
25 to 40 rose colour fill

how to set it ? I don't want indicator to change colour, just fixed background colour zones.

Can any one help ?

Try something and modify.
Have set the following condition.
ADX<25 color rose.
ADX>25 Colorpalegreen.


Code:
Plot( 1, "", IIf(ADX(15)>25 , colorPaleGreen,colorrose  ),styleArea | styleOwnScale, 0, 1 );
 

Similar threads