Beruflich Dokumente
Kultur Dokumente
/*Gann HiLo*/
per=Optimize("Per",Param("Per",42,1,55,1),1,55,1);
Hld = IIf(C > Ref(MA(H, per), -1), 1, IIf(C < Ref(MA(L, per), -1), -1, 0));
Hlv = ValueWhen(Hld != 0, Hld, 1);
Hilo = IIf(Hlv == -1, MA(H, per), MA(L, per));
Trigger = IIf(C>Hilo, colorCustom9, colorCustom5);
Plot(C,"",1,128);
Plot(Hilo, _DEFAULT_NAME(), Trigger, styleStaircase);
SetPositionSize( 50, spsShares );
Buy=Cross(C,Hilo);
Sell=Cross(Hilo,C);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-25);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-25);
_SECTION_END();
_SECTION_BEGIN("SAM");
P = ParamField("Price field",-1);
Periods = Param("Periods", 19, 2, 300, 1 );
Width = Param("Width", 2.1, 0, 10, 0.05 );
Color = ParamColor("Color", colorBlue );
Style = ParamStyle("Style", styleLine | styleNoLabel);
_SECTION_BEGIN("Background_Setting");
SetChartBkGradientFill( ParamColor("BgTop", colorWhite),
_SECTION_BEGIN("SAM");
//------------------------------------------------------------------------------
// Both indicator and exploration code for combination of fibonacci
// retracements identified in "Fibonacci for the Active Trader" by Derrik
// Hobbes. Determines pivots, draws retracements, and explores for them.
//------------------------------------------------------------------------------
// **************************
// BEING EXPLORATION CODE
// **************************
ADX8 = ADX(8);
GraphXSpace=7;
if (bDraw) {
Plot(MA(C, 15), "15 bar MA", colorRed,
styleLine+styleNoRescale+styleNoLabel);
Plot(MA(C, 55), "55 bar MA", colorBlack,
styleLine+styleNoRescale+styleNoLabel);
//Plot(MA(C, 233), "233 bar MA", colorDarkRed,
// styleLine+styleNoRescale+styleNoLabel);
}
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";
/* *************************
Finding missed pivot(s)
************************* */
lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];
/*
Note - I'm only interested in adding pivots if I'm in
a higher-highs or lower-lows scenario
*/
// -- OK, let's start where the last high pivot occurs after the
// last Low pivot
if (lastHPIdx > lastLPIdx) {
/* ************************************************** **************
Still finding missed pivot(s). Here, the last piv is a low piv.
************************************************** ************** */
} else {
/* ****************************************
// -- Done with finding pivots
***************************************** */
if (bDraw) {
/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */
minRtrc = 0;
maxRtrc = 0;
minLine = 0;
maxLine = 0;
triggerLine = 0;
firstProfitLine = 0;
triggerInc = 0;
triggerPrc = 0;
firstProfitPrc = 0;
retrcPrc = 0;
retrcBar = 0;
retrcBarIdx = 0;
retrcRng = 0;
aRetrcPrc = H-H;
aRetrcPrcBars = H-H;
aRetrcClose = C;
retrcClose = 0;
tcz500 =
(aHPivHighs[0] -
(.5 * (aHPivHighs[0] - aLPivLows[1])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[0] - aLPivLows[1])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
// -- bTCZLong setup?
bTCZLong = (
tcz500 =
(aHPivHighs[1] -
(.5 * (aHPivHighs[1] - aLPivLows[0])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[1] - aLPivLows[0])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
bTCZShort = (
// -- Are retracement levels arranged in
// tcz order?
// **************************
// END EXPLORATION CODE
// **************************
// **************************
// BEGIN INDICATOR CODE
// **************************
ADX8 = ADX(8);
GraphXSpace=7;
if (bDraw) {
Plot(MA(C, 15), "15 bar MA", colorRed,
styleLine+styleNoRescale+styleNoLabel);
Plot(MA(C, 55), "55 bar MA", colorBlack,
styleLine+styleNoRescale+styleNoLabel);
//Plot(MA(C, 233), "233 bar MA", colorDarkRed,
// styleLine+styleNoRescale+styleNoLabel);
}
nHPivs = 0;
nLPivs = 0;
lastHPIdx = 0;
lastLPIdx = 0;
lastHPH = 0;
lastLPL = 0;
curPivBarIdx = 0;
curTrend = "";
if (aLLVBars[curBar] < aHHVBars[curBar])
curTrend = "D";
else
curTrend = "U";
/* *************************
Finding missed pivot(s)
************************* */
lastLPIdx = aLPivIdxs[0];
lastLPL = aLPivLows[0];
lastHPIdx = aHPivIdxs[0];
lastHPH = aHPivHighs[0];
/*
Note - I'm only interested in adding pivots if I'm in
a higher-highs or lower-lows scenario
*/
// -- OK, let's start where the last high pivot occurs after the
// last Low pivot
if (lastHPIdx > lastLPIdx) {
/* ************************************************** **************
Still finding missed pivot(s). Here, the last piv is a low piv.
************************************************** ************** */
} else {
/* ****************************************
// -- Done with finding pivots
***************************************** */
if (bDraw) {
/* ****************************************
// -- Done with discovering and plotting pivots
***************************************** */
minRtrc = 0;
maxRtrc = 0;
minLine = 0;
maxLine = 0;
triggerLine = 0;
firstProfitLine = 0;
triggerInc = 0;
triggerPrc = 0;
firstProfitPrc = 0;
retrcPrc = 0;
retrcBar = 0;
retrcBarIdx = 0;
retrcRng = 0;
aRetrcPrc = H-H;
aRetrcPrcBars = H-H;
aRetrcClose = C;
retrcClose = 0;
tcz500 =
(aHPivHighs[0] -
(.5 * (aHPivHighs[0] - aLPivLows[1])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[0] - aLPivLows[1])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
retrcPrc = aRetrcPrc[curBar];
retrcBarIdx = curBar - aRetrcPrcBars[curBar];
retrcClose = aRetrcClose[retrcBarIdx];
// -- bTCZLong setup?
bTCZLong = (
tcz500 =
(aHPivHighs[1] -
(.5 * (aHPivHighs[1] - aLPivLows[0])));
tcz618 =
(aHPivHighs[0] -
(.618 * (aHPivHighs[1] - aLPivLows[0])));
tcz786 =
(aHPivHighs[0] -
(.786 * (aHPivHighs[0] - aLPivLows[0])));
bTCZShort = (
// -- Are retracement levels arranged in
// tcz order?
if (bShowTCZ) {
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz500, curBar, tcz500 , 0),
"tcz500", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz618, curBar, tcz618, 0),
"tcz618", colorPaleBlue, styleLine);
Plot(
LineArray( IIf(bTCZLong, aHPivIdxs[0], aLPivIdxs[0]),
tcz786, curBar, tcz786, 0),
"tcz786", colorTurquoise, styleLine);
}
// -- if (bShowTCZ)
}
if (bDraw) {
Title = Name() + " (" + StrLeft(FullName(), 10) +
") ATR: " + NumToStr(ATR(1), 4.2) + " ( " +
NumToStr((C - Ref(C, -1)), 4.2) + " / " +
NumToStr((((C - Ref(C, -1)) / Ref(C, -1)) * 100), 2.1) + "% ) " +
WriteVal( SelectedValue( DateTime() ), formatDateTime) +
" \nO: " + Open +
", \nH: " + High +
", \nL: " + Low +
", \nC: " + Close + ", \n" +
// "Risk: " + WriteVal(risk, 2.1) + "% \n" +
"Rtrc 0/1 Pts: " + WriteVal(nRtrc0Pts, 2.1) + "/" +
WriteVal(nRtrc1Pts, 2.1) + " \n" +
"Rtrc 0/1 Bars: " + WriteVal(nRtrc0Bars, 2.0) + "/" +
WriteVal(nRtrc1Bars, 2.0);
}
// **************************
// END INDICATOR CODE
// **************************
_SECTION_END();
_SECTION_BEGIN("SAM");
P = ParamField("Price field",-1);
Periods = Param("Periods", 19, 2, 300, 1 );
Width = Param("Width", 2.1, 0, 10, 0.05 );
Color = ParamColor("Color", colorBlue );
Style = ParamStyle("Style", styleLine | styleNoLabel);