can any body have this afl

#2
Hi
It is just an afl with pivots on it and shortstop & longstop on15min chart.
we have stoploss code already made by KelvinHand- including both long and short stop.
-------------------------------------------------------------------------------------------------
_SECTION_BEGIN("Trailing stoploss");
lookbackPeriod = Param("Lookback period", 20, 15, 30);
stoplossPercentage = Param("Stoploss Percentage", 7, 2, 10);//choose for intraday 2,daily 7)
Plot(HHV(C,lookbackPeriod) - HHV(C,lookbackPeriod) * (stoplossPercentage / 100), "Trailing stoploss", ParamColor( "Color", colorCycle ));
_SECTION_END();

Buy=C>(HHV(C,lookbackPeriod) - HHV(C,lookbackPeriod) * (stoplossPercentage / 100));
Sell=C<(HHV(C,lookbackPeriod) - HHV(C,lookbackPeriod) * (stoplossPercentage / 100)); Buy = ExRem(Buy, Sell); Sell = ExRem(Sell, Buy); PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low); PlotShapes(Sell*shapeDownArrow,colorRed,0,High);

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

----------------------------------- THE ABOVE IS JUST FOR TRAILING STOP-----------------
BELOW IS Price chart with pivots and chandelier green long and red short stops
----------------------------
/*
Formula Name: Chandelier Exit OR Advanced Trailing Stop
Author/Uploader: Rob Duff -
Date/Time added: 2006-09-27 19:33:33
Origin: Received from another AmiBroker user Mr. Valley.
Keywords: ATR Advanced Trailing Stop Chandelier
Level: medium
Flags: indicator

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users AND are provided here on an "as is" AND "as available" basis. AmiBroker.com makes no representations OR warranties of any kind to the contents OR the operation of material presented here. We do NOT maintain nor provide technical support for 3rd party formulas.
Description:

Chandelier Exit v2 by Geoff Mulhall
Modified 1-Feb-2003 to take advantage of Ami 2.5 Param Functionality AND to allow for Short Trades as well as Long Trades. The Chandelier Exit is a Volatility based exit. Refer to http://www.traderclub.com/discus/board.html Bulletin 35 Trailing Stops - The Chandelier Exit for more detail. Set Scaling to Automatic, Set Gridlines as follows Level 0 On, Show dates On, Middle On Right Click anywhere in the Chart, Select Parameters to get the Param Dialogue and move the slides to see the effect of changing ATRMultiplier ATRRange & HHVRange.
Formula:
*/
SetChartBkColor(64);
/* Chandelier Exit v2 */
/* by Geoff Mulhall */
/* Modified 1-Feb-2003 to take advantage of Ami 2.5 Param Functionality */
/* and to allow for Short Trades as well as Long Trades */
/* The Chandelier Exit is a Volatility based exit. */
/* Refer to http://www.traderclub.com/discus/board.html
/* Bulletin 35 Trailing Stops - The Chandelier Exit for more detail */
/* Set Scaling to Automatic, Set Gridlines as follows Level 0 On, Show dates
On, Middle On */
/* Right Click anywhere in the Chart, Select Parameters to get the Param
Dialogue and move the slides to */
/* see the effect of changing ATRMultiplier ATRRange & HHVRange */

/* Plot the Chart */
//Title = "Chandelier";
GraphXSpace = 5;
/* Candle chart */
//Plot(Close,"Close",1,styleBar);
Plot(Close,"Close",1,styleCandle);

//Plot(WMA(Close,30),"Close WMA30",4,1);
/* Chandelier Exit */
/* Param( "ATRMultiplier", default, Min, Max, step ); */
ShortLongSwitch = Param( "Sht(0) Lng(1)",1,0,1,1); // Set to 0 for a Short Trade, 1 for a Long Trade
HighCloseSwitch = Param( "C(0) H/L(1)",1,0,1,1); // Set to 0 to hang from the Close, 1 for High (Long) OR Low (Short)
ATRMultiplier =3.0;// Param( "ATR Mult", 3.0, 1, 4, 0.1);
ATRRange =10; // Param( "ATR Rng", 10, 2, 30, 1);
HHVLLVRange =10;// Param( "HHVLLV Rng", 10, 2, 30, 1);
LongExitHungExHigh = HHV(High - AtrMultiplier * ATR(AtrRange),HHVLLVRange);
LongExitHungExClose = HHV(Close - AtrMultiplier * ATR(AtrRange),HHVLLVRange);
ShortExitHungExLow = LLV(Low + AtrMultiplier * ATR(AtrRange),HHVLLVRange);
ShortExitHungExClose = LLV(Close + AtrMultiplier * ATR(AtrRange),HHVLLVRange);
LongExit = IIf(HighCloseSwitch == 1, LongExitHungExHigh,LongExitHungExClose);
ShortExit = IIf(HighCloseSwitch == 1,
ShortExitHungExLow,ShortExitHungExClose);
Exit1 = IIf(ShortLongSwitch == 1, LongExit, ShortExit);
Exit0 = shortExit;
Plot(Exit1,"Chandelier Green",colorBrightGreen,styleLine);
Plot(Exit0,"Chandelier Red",colorRed,styleLine);
G0 = Close;
G1 = Exit1;
G2 = Exit0;
Buy = Cross(G0,G1); // OR Cross(G0,G2);
//Cover = Cross(G0,G1); // OR Cross(G0,G2);
Sell = Cross(G2,G0); // OR Cross(G1,G0);
//Short = Sell ; //Cross(G2,G0); // OR Cross(G1,G0);
Short=Sell;
Cover=Buy;
Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
Equity(1);
B1 = (Buy * Close);
S1 = (Sell * Close);
B2= B1>S1;
S2= S1>B1;
Equity(1);
Buy1 = Buy;
Sell1 = Sell;
//////////////////////////////////////
//Plot(B1, "B1",5,6);
PlotShapes( IIf( Sell , shapeSmallDownTriangle/*+ "shapePositonAbove"*/,
shapeNone ), colorRed );
PlotShapes( IIf( Buy , shapeSmallUpTriangle/*+ "shapePositonAbove"*/, shapeNone
), colorBrightGreen );
Plot(3, /* defines the height of the ribbon in percent of pane width */"",IIf(
B2, colorBrightGreen, IIf( S2, colorRed, 0 )), /* choose
color*/styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );



DayH = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); // low
DayC = TimeFrameGetPrice("C", inDaily, -1); // close
DayO = TimeFrameGetPrice("O", inDaily); // current day open
PPD = (DayL + DayH + DayC)/3 ;
R1 = (2 * PPD) - DayL;
S1 = (2 * PPD) - DayH;
R2 = (PPD - S1) + R1;
S2 = PPD - (R1 - S1);
PP = (L + H + C)/3 ;


Plot(R1, "",colorBrightGreen,styleDots+styleNoLine+styleNoLabel);
Plot(S1, "",colorYellow,styleDots+styleNoLine+styleNoLabel);
//Plot(R2, "R2",colorGreen,styleDots+styleNoLine+styleNoLabel);
//Plot(S2, "S2",colorDarkRed,styleDots+styleNoLine+styleNoLabel);
//Plot(PPD, "PIVOT DAILY",colorOrange,styleLine+styleNoLabel);

DayOPEN = TimeFrameGetPrice("O", inDaily); // current day open

Plot(DAYOpen, "",colorWhite,styleLine+styleNoLabel);
======================================================================
Question
what is your reference for price movement on a trading day?
It is the days Opening price.
Price can only move in 3 ways-rise above opening price,fall below opening price,or do both or go nowhere just hang on around opening price.
If you can observe this for a 60 charts,then you are ok to be a trader.if you cant then you automatically enroll yourself into 98% daytrading loser bandwagon.
what is your choice?

I have plotted dayopen price as white line.
if price rises above day open we have a long day-bullish.if price falls below day open,we have a short day-bearish.on some days price may fall below open first forcing traders to go short(without stoploss) and price pushes back above days open price into bullish zone thus trading emotional traders who have no protection.

-------------------------------------------------------------
Action time
Traders refuse to think and refuse to quit with small loss.
What about you? just ask yourself.
How can you do a months trading in a weeks time?
why you need to do this?
Think about it.and do something.
 
Last edited:

Similar threads