Coding an Exit method - AmiBroker | futures io social day trading
futures io futures trading


Coding an Exit method
Updated: Views / Replies:3,205 / 11
Created: by Alessandro47 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Coding an Exit method

  #11 (permalink)
Elite Member
Toronto, Canada
 
Futures Experience: Advanced
Platform: Amibroker, Multicharts
Favorite Futures: Stocks
 
Posts: 3 since Mar 2013
Thanks: 0 given, 1 received

Trailing Stops

A few good examples of trailing stops in Amibroker.
From the Traders Tips section of Technical Analysis of Stocks and Commodities magazine, May 2009:
Version(5.20); // requires v5.20
SetBarsRequired(sbrAll);

// get start date
Start = Cross( DateNum(), ParamDate(„Start date”, „2005-10-30” ) );
Started = Flip( Start, 0 );

StopMode = ParamToggle(„Stop Mode”, „Fixed|Chandelier” );
StopLevel = Param(„Fixed perc %”, 14, 0.1, 50, 0.1)/100;
StopATRFactor = Param(„Chandelier ATR multiple”, 4, 0.5, 10, 0.1 );
StopATRPeriod = Param(„Chandelier ATR period”, 14, 3, 50 );

// calculate support and resistance levels
if( StopMode == 0 ) // fixed percent trailing stop
{
sup = C * ( 1 - stoplevel );
res = C * ( 1 + stoplevel );
}
else // Chandelier ATR-based stop
{
sup = C - StopATRFactor * ATR( StopATRPeriod );
res = C + StopATRFactor * ATR( StopATRPeriod );
}

// calculate trailing stop line
trailARRAY = Null;
trailstop = 0;
for( i = 1; i < BarCount; i++ )
{
if( Started[ i ] == 0 ) continue;

if( C[ i ] > trailstop AND C[ i - 1 ] > trailstop )
trailstop = Max( trailstop, sup[ i ] );
else
if( C[ i ] < trailstop AND C[ i - 1 ] < trailstop )
trailstop = Min( trailstop, res[ i ] );
else
trailstop = IIf( C[ i ] > trailstop, sup[ i ], res[ i ] );

trailARRAY[ i ] = trailstop;
}

// generate buy/sell signals based on crossover with trail stop line
Buy = Start OR Cross( C, trailArray );
Sell = Cross( trailArray, C );

PlotShapes(Buy*shapeUpArrow,colorGreen,0,trailarray);
PlotShapes(Sell*shapeDownArrow,colorRed,0,trailarray);

Plot( Close,”Price”,colorBlack,styleBar);
Plot( trailARRAY,”trailing stop level”, colorRed );

—Tomasz Janeczko

Reply With Quote
 
  #12 (permalink)
Trading Apprentice
wadi hof + cairo/EGYPT
 
Futures Experience: Intermediate
Platform: AMIBROKER
Favorite Futures: Stocks
 
Posts: 2 since Sep 2014
Thanks: 0 given, 0 received


jlwtrading View Post
A few good examples of trailing stops in Amibroker.
From the Traders Tips section of Technical Analysis of Stocks and Commodities magazine, May 2009:
Version(5.20); // requires v5.20
SetBarsRequired(sbrAll);

// get start date
Start = Cross( DateNum(), ParamDate(„Start date”, „2005-10-30” ) );
Started = Flip( Start, 0 );

StopMode = ParamToggle(„Stop Mode”, „Fixed|Chandelier” );
StopLevel = Param(„Fixed perc %”, 14, 0.1, 50, 0.1)/100;
StopATRFactor = Param(„Chandelier ATR multiple”, 4, 0.5, 10, 0.1 );
StopATRPeriod = Param(„Chandelier ATR period”, 14, 3, 50 );

// calculate support and resistance levels
if( StopMode == 0 ) // fixed percent trailing stop
{
sup = C * ( 1 - stoplevel );
res = C * ( 1 + stoplevel );
}
else // Chandelier ATR-based stop
{
sup = C - StopATRFactor * ATR( StopATRPeriod );
res = C + StopATRFactor * ATR( StopATRPeriod );
}

// calculate trailing stop line
trailARRAY = Null;
trailstop = 0;
for( i = 1; i < BarCount; i++ )
{
if( Started[ i ] == 0 ) continue;

if( C[ i ] > trailstop AND C[ i - 1 ] > trailstop )
trailstop = Max( trailstop, sup[ i ] );
else
if( C[ i ] < trailstop AND C[ i - 1 ] < trailstop )
trailstop = Min( trailstop, res[ i ] );
else
trailstop = IIf( C[ i ] > trailstop, sup[ i ], res[ i ] );

trailARRAY[ i ] = trailstop;
}

// generate buy/sell signals based on crossover with trail stop line
Buy = Start OR Cross( C, trailArray );
Sell = Cross( trailArray, C );

PlotShapes(Buy*shapeUpArrow,colorGreen,0,trailarray);
PlotShapes(Sell*shapeDownArrow,colorRed,0,trailarray);

Plot( Close,”Price”,colorBlack,styleBar);
Plot( trailARRAY,”trailing stop level”, colorRed );

—Tomasz Janeczko

please , i need to change the start date from long side to short side
thanks

Reply With Quote

Reply



futures io > > > > Coding an Exit method

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding help Pitrader EasyLanguage Programming 5 January 30th, 2014 10:12 AM
timed exit sr114 AmiBroker 2 January 16th, 2013 11:46 AM
It's all about the exit DarkPoolTrading Traders Hideout 1 May 28th, 2012 05:47 AM
Exit Only Strategy ? buylosellhi MultiCharts 6 November 15th, 2011 09:38 PM
Coding a simple entry and exit johni EasyLanguage Programming 10 July 1st, 2011 07:44 AM


All times are GMT -4. The time now is 08:46 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-10 in 0.08 seconds with 19 queries on phoenix via your IP 54.83.122.227