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

[amibroker] Help With Indicator



PureBytes Links

Trading Reference Links

 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]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/