I really need help with this script so as to get the pi codes for the same

13 May 2015 at 01:57 AM

bose 

Hi Nithin can you help me out with this, i need the Pi script for this code,
/****************************/
/* */
/* Quadra Trading System */
/* Version 1.35 */
/* (22 December 2012) */
/* */
/****************************/

SetChartOptions(0, chartShowDates | chartWrapTitle);

/**********************/
/* */
/* Define Wilder’s MA */
/* */
/**********************/

function WilderMA(Field, Period)
{
X[0] = Field[0];

for(i = 1; i < BarCount; i++)
{
X[i] = Field[i]/Period + X[i – 1] * (Period – 1)/Period;
}
return X;
}

/**********************/
/* */
/* Define EMA */
/* */
/**********************/

function MyEMA(Field, Period)
{
Y[0] = Field[0];
for(i = 1; i O;
Red = C = C[i – 1]) Green[i] = 1;
if(Red[i – 1] AND C[i] <= C[i – 1]) Red[i] = 1;
}
}

/********************/
/* */
/* COMPUTE SL */
/* */
/********************/

PrevHi = H;
PrevLo = L;
SLBuy = Null;
SLShort = Null;
GUp = GapUp();
GDn = GapDown();

for(i = 2; i = L[i – 1] AND L[i – 1] <= L[i])
{
PrevLo[i] = L[i – 1];
}

PrevHi[i] = PrevHi[i – 1];
if(H[i – 2] = H[i])
{
PrevHi[i] = H[i – 1];
}

}

/********************/
/* */
/* BUY/SELL */
/* */
/********************/

Buy = (A1 > A2 AND A2 > A3);
Sell =(A1 < A2 AND A2 < A3);

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

Bought = Flip(Buy, Sell);
Sold = Flip(Sell, Buy);

for(i = 1; i
{
SLShort[i] = Min(PrevHi[i], PrevHi[i – 1]) + 0.1;
if(GDn[i]) SLShort[i] = L[i – 1] + 0.1;
if(Sell[i]) break;
}
for(i = 1; i
{
SLBuy[i] = Max(PrevLo[i], PrevLo[i – 1]) – 0.1;
if(GUp[i]) SLBuy[i] = H[i – 1] – 0.1;
if(Buy[i]) break;
}

for(i = 1; i SLShort[i – 1]) SLShort[i] = SLShort[i – 1];
}

Marker1 = Buy * shapeUpArrow + Sell * shapeDownArrow;
MarkerColor = IIf(Buy, colorBrightGreen, colorYellow);
Marker1Dist = IIf(Buy, 0.995 * L, 1.005 * H);

/***********************/
/* */
/* SHOW/HIDE Option */
/* */
/***********************/

Arrows = ParamToggle(“Show Arrows”, “NO|YES”, True);
ShowTSL= ParamToggle(“Show TSL Line”, “NO|YES”);

_N(Title = EncodeColor(colorLightGrey) + “QUADRA EOD TRADING SYSTEM Concept by Savant Garde\n”
+ EncodeColor(colorYellow) + “Implementation by Anant Navale; AFL Version 1.35\n\n”
+ EncodeColor(colorPink) + StrFormat(“{{NAME}}({{INTERVAL}}), {{DATE}} : {{OHLCX}}, Vol=%1.0f\n{{VALUES}}\n”, V)
+ EncodeColor(colorBrightGreen) + WriteIf(Green, ” Green Candle”, “”)
+ EncodeColor(colorRed) + WriteIf(Red, ” RedCandle\n\n”, “\n\n”)
+ EncodeColor(colorWhite) + WriteIf(Buy, “Buy Above ” + (H + 0.1), “”)
+ WriteIf(Sell, “Sell Below ” + (L – 0.1), “”)
+ WriteIf(Buy, ” StopLoss = ” + SLBuy, “”) + WriteIf(Sell, ” StopLoss = ” + SLShort, “”));

if(Status(“action”) == actionIndicator)
{

/****************/
/* */
/* ALERT OUTPUT */
/* */
/****************/

TxtX = Param(“Text Left”, 800, 0, 1000, 10);
TxtY = Param(“Text Top”, 50, 1, 650, 10);

GfxSelectFont(“Tahoma”, 14, 700 );
GfxSetBkMode(1); 

if(LastValue(Buy) OR SelectedValue(Buy))
{
GfxSetTextColor(colorBrightGreen);
GfxTextOut(“BUY Triggered”, TxtX, TxtY);
Say(“Buy Triggered”);
}

else if(LastValue(Sell) OR SelectedValue(Sell))
{
GfxSetTextColor(colorGold);
GfxTextOut(“SELL Triggered”, TxtX, TxtY);
Say(“Sell Triggered”);
}

else
{
GfxSetTextColor(colorBlack);
GfxTextOut(“”, TxtX, TxtY);
}

Plot(A4, “EMA50″, colorLightGrey, styleLine | styleThick);
Plot(A3, “Wilder MA1″, colorRed, styleLine);
Plot(A2, “Wilder MA2″, colorLightOrange, styleLine);
Plot(A1, “Wilder MA3″, colorBrightGreen, styleLine);

if(ShowTSL)
{
Plot(SLBuy, “SL for Buy”, colorLightBlue, styleDots);
Plot(SLShort, “SL for Short”, colorGold, styleDots);
}

Plot(C, “”, IIf(Green, colorGreen, IIf(Red, colorRed, colorGrey50)), styleCandle);

if(Arrows)
{
PlotShapes(Marker1, MarkerColor, 0, MArker1Dist);
}
}

if(Status(“action”) == actionExplore)
{
Filter = Buy OR Sell;

SetOption(“NoDefaultColumns”, True);
AddTextColumn(Name(), “SYMBOL”);
AddColumn(DateTime(), “DATE”, formatDateTime);
AddColumn(IIf(Buy, 66, 83), “TRIGGER”, formatChar, colorWhite, IIf(Buy, colorGreen, colorRed));
AddColumn(IIf(Buy, H + 0.1, L – 0.1), “TRIG PRICE”, 1.2);
AddColumn(IIf(Buy, SLBuy, SLShort), “Stop Loss”, 1.2);
AddColumn(C, “Last Close”, 1.2);
}

A1, A2, A3 not defined , specify the condition clearly,

As per above you can use

CROSSOVER(EMA(CLOSE, 20), EMA(CLOSE, 60))