Simple Coding Help - No Promise.

#51
Happy and toug

What would be the probability of trade that has had bullish crossover on all time frames?

In theory, it does mean strongest buy but IMHO it may be impractical because by the time, bullish crossover trade trickles upwards to reach the top most time frame, it would have already reversed on lower time frames.

Another way to phrase this question would be to "What time frames are best for What trade periods?"
I don't think using more than 3 will be helpful . . .

But its ok to try these things, one gets to understand coding, the price structure and the inter-relation between multi-TFs,

so creative thinking and experimentation is never a problem . . .


the thing is all of us can arrive at different conclusions, as per our learning


Cheers
 
#53
it is to find the stocks which have ltp = 278 ema = 275
so output = price below/above (criteria for exploration) + diff in ema & ltp
Code:
//Exploration

Filter = 1; /* all symbols and quotes accepted */
//Filter = Close > MA( Close, 20 ); /* only stocks trading above its 20 day MA*/

AddColumn(Close - MA( Close, 20 ),"Delta",1.0);


AddColumn(Open,"Open",1.4);
AddColumn(High,"High",1.4);
AddColumn(Low,"Low",1.4);
AddColumn(Close,"Close",1.4);
AddColumn(Volume,"Volume",1.0);

AddColumn( MACD(), "MACD", 1.4 );
AddColumn( Signal(), "Signal", 1.4 );
AddColumn( ADX(), "ADX", 1.4 );
AddColumn( RSI(), "RSI", 1.4 );
AddColumn( ROC( Close, 15 ), "ROC(15)", 1.4 );
AddColumn( MFI(), "MFI", 1.4 );
AddColumn( OBV(), "OBV", 1.4 );
AddColumn( CCI(), "CCI", 1.4 );
AddColumn( Ultimate(), "Ultimate", 1.4 );
Comment out the un-required columns
 

a1b1trader

Well-Known Member
#55
Don't know how your panel is coded but any way try these steps

there are 2 type of graphics functions one using 4 co-ordinates other using only 2

the ones with just 2 is x, y
the ones with 4 is start-x, start-y, end-x, end-y

sample panel

Code:
GfxSelectPen(colorWhite,2); 
GfxMoveTo(100,100); 
GfxLineTo(100,200); 
GfxLineTo(300,200); 
GfxLineTo(300,100); 
GfxLineTo(100,100); 
GfxSelectFont("Comic Sans MS",12,600);
GfxSetBkColor( colorBlack);
GfxSetTextColor(colorRed);
GfxDrawText(" I  WaS  There",140,130,450,250,0);
GfxDrawText("Now I Am Here",140,160,450,250,0);
new code for above with movable panel :thumb:

Code:
x = Param("ADD X", 0,0,1200,10);
GfxSelectPen(colorWhite,2); 
GfxMoveTo(100+x,100); 
GfxLineTo(100+x,200); 
GfxLineTo(300+x,200); 
GfxLineTo(300+x,100); 
GfxLineTo(100+x,100); 
GfxSelectFont("Comic Sans MS",12,600);
GfxSetBkColor( colorBlack);
GfxSetTextColor(colorRed);
GfxDrawText(" I  WaS  There",140+x,130,450+x,250,0);
GfxDrawText("Now I Am Here",140+x,160,450+x,250,0);
Cheers


:) Happy
Thanks for your suggestion.

I am sorry, forgot to post the code.

Here it is

Code:
_SECTION_BEGIN("TScore");
//*********************************************************
   //http://finantepersonale.blogspot.com/	
   //writted by Emmen	   			
   //Trend Score Monitor
//*********************************************************
HaClose =EMA((O+H+L+C)/4,3);  // Woodie 
HaOpen = IIf(BarIndex()>0,AMA( Ref( HaClose, -1 ), 0.5 ),Open);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) ); 

p1=Param("Extreme period1",5,3,10);
p2=Param("Extreme period2",8,3,20);
p3=Param("Extreme period3",13,3,50);

HaDiff = IIf(HaClose>HaOpen, 1, IIf(HaClose<HaOpen,-1,0));
HaDiff1 = IIf(HaClose>EMA(HaClose,p1), 1, IIf(HaClose<EMA(HaClose,p1),-1,0));
HaDiff2 = IIf(HaClose>EMA(HaClose,p2), 1, IIf(HaClose<EMA(HaClose,p2),-1,0));
HaDiff3 = IIf(HaClose>EMA(HaClose,p3), 1, IIf(HaClose<EMA(HaClose,p3),-1,0));
HaDiff4 = IIf(EMA(HaClose,p1)>EMA(HaClose,p2), 1, IIf(EMA(HaClose,p1)<EMA(HaClose,p2),-1,0));
HaDiff5 = IIf(EMA(HaClose,p2)>EMA(HaClose,p3), 1, IIf(EMA(HaClose,p2)<EMA(HaClose,p3),-1,0));
HaDiff6 = IIf(HaClose>Ref(HaClose,-1), 1, IIf(HaClose<Ref(HaClose,-1),-1,0));

TScore = HaDiff + HaDiff1 + HaDiff2 + HaDiff3 + HaDiff4 + HaDiff5 + HaDiff6;

pxchartwidth = Status("pxchartwidth");
pxchartheight = Status("pxchartheight");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");

GfxSelectPen( ColorRGB(180,180,180), width = 1, 0) ;

Color1=IIf(SelectedValue(TScore)>0,ColorRGB(0,120,0),IIf(SelectedValue(TScore)<0,ColorRGB(215,0,0),GetChartBkColor()));
Color2=IIf(SelectedValue(TScore)>1,ColorRGB(0,140,0),IIf(SelectedValue(TScore)<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color3=IIf(SelectedValue(TScore)>2,ColorRGB(0,160,0),IIf(SelectedValue(TScore)<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color4=IIf(SelectedValue(TScore)>3,ColorRGB(0,180,0),IIf(SelectedValue(TScore)<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color5=IIf(SelectedValue(TScore)>4,ColorRGB(0,200,0),IIf(SelectedValue(TScore)<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color6=IIf(SelectedValue(TScore)>5,ColorRGB(0,220,0),IIf(SelectedValue(TScore)<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color7=IIf(SelectedValue(TScore)>6,ColorRGB(0,240,0),IIf(SelectedValue(TScore)<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color11=IIf(SelectedValue(Ref(TScore,-1))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-1))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color21=IIf(SelectedValue(Ref(TScore,-1))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-1))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color31=IIf(SelectedValue(Ref(TScore,-1))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-1))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color41=IIf(SelectedValue(Ref(TScore,-1))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-1))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color51=IIf(SelectedValue(Ref(TScore,-1))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-1))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color61=IIf(SelectedValue(Ref(TScore,-1))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-1))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color71=IIf(SelectedValue(Ref(TScore,-1))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-1))<-6,ColorRGB(255,80,0),GetChartBkColor())); 

Color12=IIf(SelectedValue(Ref(TScore,-2))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-2))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color22=IIf(SelectedValue(Ref(TScore,-2))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-2))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color32=IIf(SelectedValue(Ref(TScore,-2))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-2))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color42=IIf(SelectedValue(Ref(TScore,-2))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-2))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color52=IIf(SelectedValue(Ref(TScore,-2))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-2))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color62=IIf(SelectedValue(Ref(TScore,-2))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-2))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color72=IIf(SelectedValue(Ref(TScore,-2))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-2))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color13=IIf(SelectedValue(Ref(TScore,-3))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-3))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color23=IIf(SelectedValue(Ref(TScore,-3))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-3))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color33=IIf(SelectedValue(Ref(TScore,-3))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-3))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color43=IIf(SelectedValue(Ref(TScore,-3))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-3))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color53=IIf(SelectedValue(Ref(TScore,-3))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-3))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color63=IIf(SelectedValue(Ref(TScore,-3))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-3))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color73=IIf(SelectedValue(Ref(TScore,-3))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-3))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color14=IIf(SelectedValue(Ref(TScore,-4))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-4))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color24=IIf(SelectedValue(Ref(TScore,-4))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-4))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color34=IIf(SelectedValue(Ref(TScore,-4))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-4))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color44=IIf(SelectedValue(Ref(TScore,-4))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-4))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color54=IIf(SelectedValue(Ref(TScore,-4))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-4))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color64=IIf(SelectedValue(Ref(TScore,-4))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-4))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color74=IIf(SelectedValue(Ref(TScore,-4))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-4))<-6,ColorRGB(255,80,0),GetChartBkColor()));

GfxSelectSolidBrush(color14);
GfxRoundRect( 3,pxchartheight-15,13,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color24);
GfxRoundRect( 3,pxchartheight-27,13,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color34);
GfxRoundRect( 3,pxchartheight-39,13,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color44);
GfxRoundRect( 3,pxchartheight-51,13,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color54);
GfxRoundRect( 3,pxchartheight-63,13,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color64);
GfxRoundRect( 3,pxchartheight-75,13,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color74);
GfxRoundRect( 3,pxchartheight-87,13,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color13);
GfxRoundRect( 15,pxchartheight-15,25,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color23);
GfxRoundRect( 15,pxchartheight-27,25,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color33);
GfxRoundRect( 15,pxchartheight-39,25,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color43);
GfxRoundRect( 15,pxchartheight-51,25,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color53);
GfxRoundRect( 15,pxchartheight-63,25,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color63);
GfxRoundRect( 15,pxchartheight-75,25,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color73);
GfxRoundRect( 15,pxchartheight-87,25,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color12);
GfxRoundRect( 27,pxchartheight-15,37,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color22);
GfxRoundRect( 27,pxchartheight-27,37,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color32);
GfxRoundRect( 27,pxchartheight-39,37,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color42);
GfxRoundRect( 27,pxchartheight-51,37,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color52);
GfxRoundRect( 27,pxchartheight-63,37,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color62);
GfxRoundRect( 27,pxchartheight-75,37,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color72);
GfxRoundRect( 27,pxchartheight-87,37,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color11);
GfxRoundRect( 39,pxchartheight-15,49,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color21);
GfxRoundRect( 39,pxchartheight-27,49,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color31);
GfxRoundRect( 39,pxchartheight-39,49,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color41);
GfxRoundRect( 39,pxchartheight-51,49,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color51);
GfxRoundRect( 39,pxchartheight-63,49,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color61);
GfxRoundRect( 39,pxchartheight-75,49,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color71);
GfxRoundRect( 39,pxchartheight-87,49,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color1);
GfxRoundRect( 51,pxchartheight-15,61,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color2);
GfxRoundRect( 51,pxchartheight-27,61,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color3);
GfxRoundRect( 51,pxchartheight-39,61,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color4);
GfxRoundRect( 51,pxchartheight-51,61,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color5);
GfxRoundRect( 51,pxchartheight-63,61,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color6);
GfxRoundRect( 51,pxchartheight-75,61,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color7);
GfxRoundRect( 51,pxchartheight-87,61,pxchartheight-97 ,2,2) ;

_SECTION_END();
 

Gandhar.

Well-Known Member
#56
Code:
//Exploration

Filter = 1; /* all symbols and quotes accepted */
//Filter = Close > MA( Close, 20 ); /* only stocks trading above its 20 day MA*/

[B]AddColumn(Close - MA( Close, 20 ),"Delta",1.0);
[/B]

AddColumn(Open,"Open",1.4);
AddColumn(High,"High",1.4);
AddColumn(Low,"Low",1.4);
AddColumn(Close,"Close",1.4);
AddColumn(Volume,"Volume",1.0);

AddColumn( MACD(), "MACD", 1.4 );
AddColumn( Signal(), "Signal", 1.4 );
AddColumn( ADX(), "ADX", 1.4 );
AddColumn( RSI(), "RSI", 1.4 );
AddColumn( ROC( Close, 15 ), "ROC(15)", 1.4 );
AddColumn( MFI(), "MFI", 1.4 );
AddColumn( OBV(), "OBV", 1.4 );
AddColumn( CCI(), "CCI", 1.4 );
AddColumn( Ultimate(), "Ultimate", 1.4 );
Comment out the un-required columns
how do i modify to get only the +/- values for Delta
other is just perfect:D
 
#57
hi
i want candle colour as green if it is above EMA50 and Red if it is below EMA50
Code:
SetBarFillColor(IIf(C > O, GetChartBkColor(), colorRed)); 
Plot( C, "Close", IIf(C > EMA(C,50), colorGreen, colorRed), styleCandle | styleNoTitle);
 

guptak03

Well-Known Member
#58
Hello Happy Ji,

Do we have any source from wher i can write some afl's on breakout (BO),break out failure(BOF),initail Range etc which are used for price action trades ..

Requesting for source is because even i want try my idea myself 1st:thumb:
 
#59
make the changes as suggested

don't worry it will work :)

for e.g. last line of your code should be changed like this

Code:
GfxRoundRect( 51,pxchartheight-87,61,pxchartheight-97 ,2,2) ;

will change to

GfxRoundRect(51+x,pxchartheight-87,61+x,pxchartheight-97 ,2,2) ;
complete all the changes, just add the +x on all x values . . . then you can move the panel dynamically left and right

Cheers

:) Happy

Thanks for your suggestion.

I am sorry, forgot to post the code.

Here it is
Code:
_SECTION_BEGIN("TScore");
//*********************************************************
   //http://finantepersonale.blogspot.com/	
   //writted by Emmen	   			
   //Trend Score Monitor
//*********************************************************
HaClose =EMA((O+H+L+C)/4,3);  // Woodie 
HaOpen = IIf(BarIndex()>0,AMA( Ref( HaClose, -1 ), 0.5 ),Open);
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) ); 

p1=Param("Extreme period1",5,3,10);
p2=Param("Extreme period2",8,3,20);
p3=Param("Extreme period3",13,3,50);

HaDiff = IIf(HaClose>HaOpen, 1, IIf(HaClose<HaOpen,-1,0));
HaDiff1 = IIf(HaClose>EMA(HaClose,p1), 1, IIf(HaClose<EMA(HaClose,p1),-1,0));
HaDiff2 = IIf(HaClose>EMA(HaClose,p2), 1, IIf(HaClose<EMA(HaClose,p2),-1,0));
HaDiff3 = IIf(HaClose>EMA(HaClose,p3), 1, IIf(HaClose<EMA(HaClose,p3),-1,0));
HaDiff4 = IIf(EMA(HaClose,p1)>EMA(HaClose,p2), 1, IIf(EMA(HaClose,p1)<EMA(HaClose,p2),-1,0));
HaDiff5 = IIf(EMA(HaClose,p2)>EMA(HaClose,p3), 1, IIf(EMA(HaClose,p2)<EMA(HaClose,p3),-1,0));
HaDiff6 = IIf(HaClose>Ref(HaClose,-1), 1, IIf(HaClose<Ref(HaClose,-1),-1,0));

TScore = HaDiff + HaDiff1 + HaDiff2 + HaDiff3 + HaDiff4 + HaDiff5 + HaDiff6;

pxchartwidth = Status("pxchartwidth");
pxchartheight = Status("pxchartheight");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");

GfxSelectPen( ColorRGB(180,180,180), width = 1, 0) ;

Color1=IIf(SelectedValue(TScore)>0,ColorRGB(0,120,0),IIf(SelectedValue(TScore)<0,ColorRGB(215,0,0),GetChartBkColor()));
Color2=IIf(SelectedValue(TScore)>1,ColorRGB(0,140,0),IIf(SelectedValue(TScore)<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color3=IIf(SelectedValue(TScore)>2,ColorRGB(0,160,0),IIf(SelectedValue(TScore)<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color4=IIf(SelectedValue(TScore)>3,ColorRGB(0,180,0),IIf(SelectedValue(TScore)<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color5=IIf(SelectedValue(TScore)>4,ColorRGB(0,200,0),IIf(SelectedValue(TScore)<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color6=IIf(SelectedValue(TScore)>5,ColorRGB(0,220,0),IIf(SelectedValue(TScore)<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color7=IIf(SelectedValue(TScore)>6,ColorRGB(0,240,0),IIf(SelectedValue(TScore)<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color11=IIf(SelectedValue(Ref(TScore,-1))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-1))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color21=IIf(SelectedValue(Ref(TScore,-1))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-1))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color31=IIf(SelectedValue(Ref(TScore,-1))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-1))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color41=IIf(SelectedValue(Ref(TScore,-1))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-1))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color51=IIf(SelectedValue(Ref(TScore,-1))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-1))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color61=IIf(SelectedValue(Ref(TScore,-1))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-1))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color71=IIf(SelectedValue(Ref(TScore,-1))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-1))<-6,ColorRGB(255,80,0),GetChartBkColor())); 

Color12=IIf(SelectedValue(Ref(TScore,-2))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-2))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color22=IIf(SelectedValue(Ref(TScore,-2))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-2))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color32=IIf(SelectedValue(Ref(TScore,-2))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-2))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color42=IIf(SelectedValue(Ref(TScore,-2))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-2))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color52=IIf(SelectedValue(Ref(TScore,-2))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-2))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color62=IIf(SelectedValue(Ref(TScore,-2))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-2))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color72=IIf(SelectedValue(Ref(TScore,-2))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-2))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color13=IIf(SelectedValue(Ref(TScore,-3))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-3))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color23=IIf(SelectedValue(Ref(TScore,-3))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-3))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color33=IIf(SelectedValue(Ref(TScore,-3))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-3))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color43=IIf(SelectedValue(Ref(TScore,-3))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-3))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color53=IIf(SelectedValue(Ref(TScore,-3))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-3))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color63=IIf(SelectedValue(Ref(TScore,-3))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-3))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color73=IIf(SelectedValue(Ref(TScore,-3))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-3))<-6,ColorRGB(255,80,0),GetChartBkColor()));

Color14=IIf(SelectedValue(Ref(TScore,-4))>0,ColorRGB(0,120,0),IIf(SelectedValue(Ref(TScore,-4))<0,ColorRGB(215,0,0),GetChartBkColor()));
Color24=IIf(SelectedValue(Ref(TScore,-4))>1,ColorRGB(0,140,0),IIf(SelectedValue(Ref(TScore,-4))<-1,ColorRGB(235,0,0),GetChartBkColor()));
Color34=IIf(SelectedValue(Ref(TScore,-4))>2,ColorRGB(0,160,0),IIf(SelectedValue(Ref(TScore,-4))<-2,ColorRGB(255,0,0),GetChartBkColor()));
Color44=IIf(SelectedValue(Ref(TScore,-4))>3,ColorRGB(0,180,0),IIf(SelectedValue(Ref(TScore,-4))<-3,ColorRGB(255,20,0),GetChartBkColor()));
Color54=IIf(SelectedValue(Ref(TScore,-4))>4,ColorRGB(0,200,0),IIf(SelectedValue(Ref(TScore,-4))<-4,ColorRGB(255,40,0),GetChartBkColor()));
Color64=IIf(SelectedValue(Ref(TScore,-4))>5,ColorRGB(0,220,0),IIf(SelectedValue(Ref(TScore,-4))<-5,ColorRGB(255,60,0),GetChartBkColor()));
Color74=IIf(SelectedValue(Ref(TScore,-4))>6,ColorRGB(0,240,0),IIf(SelectedValue(Ref(TScore,-4))<-6,ColorRGB(255,80,0),GetChartBkColor()));

x = Param("ADD X", 0,0,1200,10);

GfxSelectSolidBrush(color14);
GfxRoundRect( 3+x,pxchartheight-15,13+x,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color24);
GfxRoundRect( 3+x,pxchartheight-27,13+x,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color34);
GfxRoundRect( 3+x,pxchartheight-39,13+x,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color44);
GfxRoundRect( 3+x,pxchartheight-51,13+x,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color54);
GfxRoundRect( 3+x,pxchartheight-63,13+x,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color64);
GfxRoundRect( 3+x,pxchartheight-75,13+x,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color74);
GfxRoundRect( 3+x,pxchartheight-87,13+x,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color13);
GfxRoundRect( 15+x,pxchartheight-15,25+x,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color23);
GfxRoundRect( 15+x,pxchartheight-27,25+x,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color33);
GfxRoundRect( 15+x,pxchartheight-39,25+x,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color43);
GfxRoundRect( 15+x,pxchartheight-51,25+x,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color53);
GfxRoundRect( 15+x,pxchartheight-63,25+x,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color63);
GfxRoundRect( 15+x,pxchartheight-75,25+x,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color73);
GfxRoundRect( 15+x,pxchartheight-87,25+x,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color12);
GfxRoundRect( 27+x,pxchartheight-15,37+x,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color22);
GfxRoundRect( 27+x,pxchartheight-27,37+x,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color32);
GfxRoundRect( 27+x,pxchartheight-39,37+x,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color42);
GfxRoundRect( 27+x,pxchartheight-51,37+x,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color52);
GfxRoundRect( 27+x,pxchartheight-63,37+x,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color62);
GfxRoundRect( 27+x,pxchartheight-75,37+x,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color72);
GfxRoundRect( 27+x,pxchartheight-87,37+x,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color11);
GfxRoundRect( 39+x,pxchartheight-15,49+x,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color21);
GfxRoundRect( 39+x,pxchartheight-27,49+x,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color31);
GfxRoundRect( 39+x,pxchartheight-39,49+x,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color41);
GfxRoundRect( 39+x,pxchartheight-51,49+x,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color51);
GfxRoundRect( 39+x,pxchartheight-63,49+x,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color61);
GfxRoundRect( 39+x,pxchartheight-75,49+x,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color71);
GfxRoundRect( 39+x,pxchartheight-87,49+x,pxchartheight-97 ,2,2) ;

GfxSelectSolidBrush(color1);
GfxRoundRect( 51+x,pxchartheight-15,61+x,pxchartheight-25 ,2,2) ;
GfxSelectSolidBrush(color2);
GfxRoundRect( 51+x,pxchartheight-27,61+x,pxchartheight-37 ,2,2) ;
GfxSelectSolidBrush(color3);
GfxRoundRect( 51+x,pxchartheight-39,61+x,pxchartheight-49 ,2,2) ;
GfxSelectSolidBrush(color4);
GfxRoundRect( 51+x,pxchartheight-51,61+x,pxchartheight-61 ,2,2) ;
GfxSelectSolidBrush(color5);
GfxRoundRect( 51+x,pxchartheight-63,61+x,pxchartheight-73 ,2,2) ;
GfxSelectSolidBrush(color6);
GfxRoundRect( 51+x,pxchartheight-75,61+x,pxchartheight-85 ,2,2) ;
GfxSelectSolidBrush(color7);
GfxRoundRect( 51+x,pxchartheight-87,61+x,pxchartheight-97 ,2,2) ;
_SECTION_END();
well i have tried to do the bulk replace with the text editor, just check it if it is working . . .
 
Last edited:
#60
REALLY REAL help from Happy and Kelvin! I can see light after being stuck in the tunnel for a couple of weeks. Yes, looks like these will work, and I will try it tomorrow morning for sure.

No Happy, I tried ApplyStop before but it didn't yield the desired results (sure I got it wrong). I wanted to apply stop when the loss crossed a simple percentage of entry price; and the trailing stop loss to hit when a certain profit level has been reached AND then the profit fell by say 10% of max profit so far. But I will come back to this function as yours and Kelvin's guidance has been most encouraging.
 

Similar threads