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

Re: [amibroker] Help With Indicator



PureBytes Links

Trading Reference Links

Ken,

I had weird display problems with your code. Price was a straight line at
the top. I basically rebuilt it and got it to work. I think maybe there were
oddball characters in there from the copy and paste. Anyhow this version has
StyleLine plots instead.

What I found was I couldnıt get the Buy arrows, but only got the Sell
Arrows! I finally discovered that your formula gives no Buy arrows if you
select, for example, ^NDX. Select INTC or AAPL and I get both types of
arrows.

Try selecting a bunch of different symbols to see if the arrows show up.
Then I would check out the Buy/Sell conditions to be sure theyıre what you
want.

Hereıs my version (only changes are to Plot statements):

AdjBar = Param("Bar",0,0,BarCount,1);
AdjZ = Param("Zig",10,0,20,.1);
 
//Select Current Tickers OHLC
CO = Ref(O,-AdjBar);
CH = Ref(H,-AdjBar);
CL = Ref(L,-AdjBar);
CC = Ref(C,-AdjBar);
 
//Select Foriegn OHLC
"Ticker " + TN = Name() ; // Show Ticker
"Index " + BI = GetBaseIndex(); //BI = BaseIndex String
FO = Ref(Foreign( BI,"O"),-AdjBar);
FH = Ref(Foreign( BI,"H"),-AdjBar);
FL = Ref(Foreign( BI,"L"),-AdjBar);
FC = Ref(Foreign( BI,"C"),-AdjBar);
 
//Create Trend
ZAC = Zig( CC, AdjZ );
UTrend = ZAC > Ref(ZAC, -1);
DTrend = ZAC < Ref(ZAC, -1);
 
//Do Cross (Create Result Arrays)
t1 = OscP( 3, 6 );
Cond1a= Cross (t1,MACD());
Cond1b= MACD()>-1 AND MACD()<0;
Cond1= Cond1a AND Cond1b;
Cond2 = MACD()>Signal()-.2;
Cond3 = Cross(0,t1);
 
// Select Conditions to Display.
C1 = Ref(Cond1,-AdjBar);
C2 = Ref(Cond2,-AdjBar);
C3 = Ref(Cond3,-AdjBar);
 
//Plot Data
Color = IIf(CO > CC, colorYellow, colorBlue);
Plot(C,Name(),color,styleThick);
Plot(FC,"Reference",colorLightGrey,styleLine|styleThick|styleOwnScale);//Plo
t Sector Index.
 
ZColor = IIf(UTrend, colorBlack, colorRed);
Plot( ZAC, "Zig", ZColor, styleHistogram); //Plot ZigZag Trend.
 
//Show Buy/Sell Arrows.
Buy = C1 AND C2 AND UTrend;
Sell= C3 AND DTrend;
Short = Sell;
Cover = Buy;
 
PlotShapes( shapeUpArrow * Buy, colorGreen,0,C,-20 );
PlotShapes( shapeDownArrow * Sell, colorRed,0,C,-20 );
 
// Iterpretation
"Be Aware of ZigZag Limitations.";
"Use CTRL-R to Explore Signals/Zig.";

-- 
Terry


From: "Ken Henderson" <kjh@xxxxxxxxxxxxxxx>
Reply-To: amibroker@xxxxxxxxxxxxxxx
Date: Wed, 6 Oct 2004 21:11:00 +1000
To: <amibroker@xxxxxxxxxxxxxxx>
Subject: [amibroker] Help With Indicator

 Hi

 

Can anyone suggest a solution to a problem with the indicator code below.

 

I can am able to gain an up arrow on the chart for a buy signal but am
unable to obtain a down arrow for a sell condition no matter what I do.
What am I missing here.

 

Many thanks in advance.

 

Ken

 

 

  AdjBar = Param("Bar",0,0,BarCount,1);

 

AdjZ = Param("Zig",10,0,20,.1);

 

//Select Current Tickers OHLC

 

CO = Ref(O,-AdjBar);

 

CH = Ref(H,-AdjBar);

 

CL = Ref(L,-AdjBar);

 

CC = Ref(C,-AdjBar);

 

//Select Foriegn OHLC

 

"Ticker " + TN = Name() ; // Show Ticker

 

"Index " + BI = GetBaseIndex(); //BI = BaseIndex String

 

FO = Ref(Foreign( BI,"O"),-AdjBar);

 

FH = Ref(Foreign( BI,"H"),-AdjBar);

 

FL = Ref(Foreign( BI,"L"),-AdjBar);

 

FC = Ref(Foreign( BI,"C"),-AdjBar);

 

//Create Trend

 

ZAC = Zig( CC, AdjZ );

 

UTrend = ZAC > Ref(ZAC, -1);

 

DTrend = ZAC < Ref(ZAC, -1);

 

//Do Cross (Create Result Arrays)

 

t1 = OscP( 3, 6 );

 

Cond1a= Cross (t1,MACD());

 

Cond1b= MACD()>-1 AND MACD()<0;

 

Cond1= Cond1a AND Cond1b;

 

Cond2 = MACD()>Signal()-.2;

 

Cond3 = Cross(0,t1);

 

// Select Conditions to Display.

 

C1 = Ref(Cond1,-AdjBar);

 

C2 = Ref(Cond2,-AdjBar);

 

C3 = Ref(Cond3,-AdjBar);

 

//Plot Data

 

Color = IIf(CO > CC, colorYellow, colorYellow);

 

PlotOHLC( CO,CH,CL,CC, "Price", color, styleCandle );//Plot Selected Ticker.

 

PlotOHLC( FO,FH,FL,FC, BI, colorLightGrey);//Plot Sector Index.

 

ZColor = IIf(UTrend, colorBlack, colorRed);

 

Plot( ZAC, "Zig", ZColor, 3); //Plot ZigZag Trend.

 

//Show Buy/Sell Arrows.

 

Buy = C1 AND C2 AND UTrend;

 

Sell= C3 AND DTrend;

 

PlotShapes( shapeDownArrow * Sell, colorRed );

 

PlotShapes( shapeUpArrow * Buy, colorGreen );

 

// Iterpretation

 

"Be Aware of ZigZag Limitations.";

 

"Use CTRL-R to Explore Signals/Zig.";

 



[Non-text portions of this message have been removed]



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Yahoo! Groups Sponsor
 <http://us.ard.yahoo.com/SIG=1293srkh8/M=294150.5475417.6555471.1269404/D=g
roups/S=1705632198:HM/EXP=1097147506/A=2380089/R=0/SIG=12adlsi8e/*http://mor
tgages.interest.com/includes/server/icom_campaign.asp?id=10716>
<http://us.ard.yahoo.com/SIG=1293srkh8/M=294150.5475417.6555471.1269404/D=gr
oups/S=1705632198:HM/EXP=1097147506/A=2380089/R=1/SIG=12adlsi8e/*http://mort
gages.interest.com/includes/server/icom_campaign.asp?id=10716>
Select Your State: Alabama Alaska Arkansas Arizona California Colorado
Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa
Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota
Missippi Missouri Montana Nebraska Nevada New Hampshire New Mexico New
Jersey New York North Carolina North Dakota Oklahoma Ohio Oregon
Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah
Vermont Virginia Washington Washington D.C. West Virginia Wisconsin Wyoming

Purchase Refinance 

 <http://us.ard.yahoo.com/SIG=1293srkh8/M=294150.5475417.6555471.1269404/D=g
roups/S=1705632198:HM/EXP=1097147506/A=2380089/R=3/SIG=12adlsi8e/*http://mor
tgages.interest.com/includes/server/icom_campaign.asp?id=10716>


Yahoo! Groups Links
* To visit your group on the web, go to:
* http://groups.yahoo.com/group/amibroker/
*  
* To unsubscribe from this group, send an email to:
* amibroker-unsubscribe@xxxxxxxxxxxxxxx
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
*  
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/