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

[amibroker] Hi, which function to Plot over the correct bar the "shapedigit.."? thank you


  • Date: Wed, 02 Dec 2009 01:30:48 -0000
  • From: "umbidefaccio" <umbidefaccio@xxxxxxxxxxx>
  • Subject: [amibroker] Hi, which function to Plot over the correct bar the "shapedigit.."? thank you

PureBytes Links

Trading Reference Links

//Hi, I'm learning..
//I'm trying to write a simple (not for me ;) ) custom chart, can you help me? Thank's!!
//NB: YOU CAN PASTE ALL IN FORMULA EDITOR TO READ IN DIFFERENT COLOURS, IT'S CLEARER! ;)

//CONDITIONS:
//1- NEW 20bars high
//2- then price goes down; I want sell if/when price(Close) < OLD 20 bars high within 20 bars from the NEW high


//I WROTE:

Cond01=Ref(Cross(High,Ref(HHV(High,20),-1)),-1);								//"yesterday" (one bar ago) a new 20bars High
			
MyPeriod = 20; 
for( i = 0; i < MyPeriod AND i < BarCount; i++ ) 						
{ 
Cond02=C[i] < ValueWhen(Cond01, Ref(HHV(High,20),-2)); 						//from "today" and within 20 bars Close < OLD 20bars High (the 20bars High of two bars ago)
} 				


PlotShapes( IIf(Cond01 AND Cond02,shapeDigit8,0) ,colorViolet, 0, H,30);	//Amibroker plot number "8" if cond1 and 2 over the "today bar", while I want to plot "8" 
																						//over the bar that goes under the old 20bars High; Which function can I use to do this?
																						

//NB: FOR THE SAME PATTERN I WROTE A MORE "COMPLICATE" TEXT, WITH A WORSE RESULT (the same problem but with number "7" plotted farther from the cond1, 
//because "today bar" is 20 days after the cond1; I WRITE IT BELOW:
//----------
					
Cond02=Ref(Cross(High,Ref(HHV(High,20),-1)),-20);						// 20 bars ago new 20bars High
Cond03=Ref(C,-19) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			// 19 bars ago C< old 20bars high (the 20bars high of 21 bars ago)
Cond04=Ref(C,-18) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			// 18 bars ago C< old 20bars high (the 20bars high of 21 bars ago)
Cond05=Ref(C,-17) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			// 17 bars ago C< old 20bars high (the 20bars high of 21 bars ago)
Cond06=Ref(C,-16) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			// ...
Cond07=Ref(C,-15) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			
Cond08=Ref(C,-14) < ValueWhen(Cond02, Ref(HHV(High,20),-21));			
Cond09=Ref(C,-13) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond10=Ref(C,-12) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond11=Ref(C,-11) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond12=Ref(C,-10) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond13=Ref(C,-9) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond14=Ref(C,-8) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond15=Ref(C,-7) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond16=Ref(C,-6) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond17=Ref(C,-5) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond18=Ref(C,-4) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond19=Ref(C,-3) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond20=Ref(C,-2) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond21=Ref(C,-1) < ValueWhen(Cond02, Ref(HHV(High,20),-21));
Cond22=        C < ValueWhen(Cond02, Ref(HHV(High,20),-21));			//"today" C< old 20bars high (the 20bars high of 21 bars ago)

Filter=Cond02 AND (Cond03 OR Cond04 OR Cond05 OR Cond06 OR Cond07 OR Cond08 OR Cond09 OR Cond10 OR Cond11 OR Cond12 OR Cond13 OR Cond14 OR Cond15 OR Cond16 OR Cond17 OR Cond18 OR Cond19 OR Cond20 OR Cond21 OR Cond22);


//first method to plot over the correct bar:

PlotShapes( IIf(Filter,shapeDigit7,0) ,colorGold, 0, H,35);



//second method; same result.. : 
	
PlotShapes( IIf(Cond02 AND Cond03,shapeDigit7,0) ,colorBlack, 0, H,50);		
PlotShapes( IIf(Cond02 AND Cond04,shapeDigit7,0) ,colorBlack, 0, H,50);	
PlotShapes( IIf(Cond02 AND Cond05,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond06,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond07,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond08,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond09,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond10,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond11,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond12,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond13,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond14,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond15,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond16,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond17,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond18,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond19,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond20,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond21,shapeDigit7,0) ,colorBlack, 0, H,50);
PlotShapes( IIf(Cond02 AND Cond22,shapeDigit7,0) ,colorBlack, 0, H,50);

//THANK YOU! Umberto



------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/