TradingView
HPotter
13 אוק׳ 2014 04:27

Average True Range Trailing Stops Colored 

E-mini S&P 500 FuturesCME

תיאור

Average True Range Trailing Stops Strategy, by Sylvain Vervoort
The related article is copyrighted material from Stocks & Commodities Jun 2009
תגובות
Codetrader
Hi, Thank you for posting this. I am very new to this concept and wish to ask what may be a stupid question. Here goes anyway:

Example: I have a max risk goal of not to lose more than 2% on any given trade.

1.) How would I set the inputs for this?

I have read some stuff on what is called an Average True Range Dynamic Stop.

2.) Is your script an ATR Dynamic Stop or something else?

Thanks

HPotter
Hi, codetrader
1) I can`t recomendet to you anything. I don`t use this script, I just coding it from magazine Stocks & Commodities Jun 2009. Sorry.

2) This script recalculated on the realtime and make changes in the stoploss level dynamically.
Codetrader
Okay, thanks you
RJBK93
@Codetrader, nATRperiod = aantal timeframe eenheden = 5 uren/dagen/minuten afhankelijk van je timeframe
nATRMultip = vermenigvuldingsfactor van de berekende ATR
TraderPavlos
Hey! Thanks for the script!
Question: Is it repainting?
HPotter
@TraderPavlos, You are welcome. Should be.
CrazyCarmines
Here is the Code for MLQ5 for this:

#property copyright "HPotter v2.0 13/10/2014"
#property link "tradingview.com"
#property version "1.0"
#property strict

int nATRPeriod = 5;
double nATRMultip = 3.5;
double xATR;
double nLoss;

int OnInit()
{
// Initialization
xATR = iATR(Symbol(), PERIOD_CURRENT, nATRPeriod);
nLoss = nATRMultip * xATR;

return(INIT_SUCCEEDED);
}

void OnTick()
{
double currentPrice = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
double trailingStop = currentPrice - nLoss;

if (OrderType() == ORDER_TYPE_BUY)
{
double stopLoss = OrderStopLoss();
if (currentPrice < trailingStop)
{
// Modify the stop loss to the trailing stop level
OrderModify(OrderTicket(), OrderOpenPrice(), trailingStop, OrderTakeProfit(), 0, clrNONE);
}
}
else if (OrderType() == ORDER_TYPE_SELL)
{
double stopLoss = OrderStopLoss();
if (currentPrice > trailingStop)
{
// Modify the stop loss to the trailing stop level
OrderModify(OrderTicket(), OrderOpenPrice(), trailingStop, OrderTakeProfit(), 0, clrNONE);
}
}
}
coinalert
good job harry keep going
HPotter
@coinalert, You are welcome.
vikingdahl
Hi,

Maybe a stupid question but is the default setting (NATRPERIOD: 5 and NATRMULTIP: 3.5) 2x 5 day ATR in practice? The trailing line is always 2x 5day ATR from the price? So if I change the NATRPERIOD to "14" and multipel stays at 3.5, then I get a trailing line that shows 2x 14day ATR?

Sorry for the crappy explanation :P

thanks in advance :)
עוד