strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker - MultiCharts | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > MultiCharts

strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker
Started:May 28th, 2016 (11:37 AM) by jamesfisher Views / Replies:181 / 0
Last Reply:May 28th, 2016 (11:37 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker

Old May 28th, 2016, 11:37 AM   #1 (permalink)
Trading Apprentice
City Poland
Futures Experience: Advanced
Platform: MT4,AmiBroker,MultiCharts
Favorite Futures: FX, futures, options, commodities, stocks
Posts: 11 since Sep 2012
Thanks: 1 given, 1 received

strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker

I'm doing some comparsion between possibilities (long of the code in some platforms) for strategy with rules:
- We open long positions when the current bar closes above the highest close of the preceding 10 bars. Short positions are initiated when the bar closes below the 10-bar lowest close.
- Long positions are closed when the bar crosses below the 50-period Exponential Moving Average (EMA). We exit short positions when the bar closes above this EMA.
- We use two inputs to set the EMA length and the number of bars that the highest and lowest close is calculated on.

I started coding this in EasyLanguage for MultiCharts. I'm newbie with this language (1 day of exp.). My code:

Inputs: Price(Close), Ema_Length(50), Length_Lookback(10); 
Variables: emaCurrent(0);
emaCurrent= XAverage(Price, Ema_Length);

condition1 = Price > Highest(Close[1],Length_Lookback);
condition2 = Price < emaCurrent;
condition3 = Price < Lowest(Close[1],Length_Lookback);
condition4 = Price > emaCurrent;
IF  condition1 then
Buy 1 contract this bar at Close;

IF  condition2 then
Sell this bar at Close;

IF  condition3 then
sellshort 1 contract  this bar at Close;

IF  condition4 then
buytocover this bar at Close;

This same strategy is coded for MultiCharts.NET and present on with length 103 lines in C#.

My working code for AmiBroker (32 lines of the code):

PeriodEMA= Param("PeriodEMA", 50,1,60,1);
PeriodLookback= Param("PeriodLookback", 10,1,60,1);

wartosc_EMA = EMA(C,PeriodEMA);
gorna_banda = Ref(HHV(C,PeriodLookback),-1);
dolne_banda = Ref(LLV(C,PeriodLookback),-1);

otworz_LONG = Cross(C,gorna_banda);
otworz_SHORT = Cross(dolne_banda,C);
zamknij_LONG  = Cross(wartosc_EMA,C);
zamknij_SHORT = Cross(C,wartosc_EMA);

Buy = otworz_LONG;
Sell = zamknij_LONG;
Short = otworz_SHORT;
Cover = zamknij_SHORT;

BuyPrice = ShortPrice = SellPrice = CoverPrice = C;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = ExRem(Short,Cover);
Cover = ExRem(Cover,Short);
-- --

I will be greatful for finishing my code for MultiCharts, so I will have full picture of length of the code. Thanks a lot!

Last edited by jamesfisher; May 29th, 2016 at 04:54 AM.
Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > MultiCharts > strategy with EMA and range - comaprison of codes in MultiCharts /.NET / AmiBroker

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sma, ema and range bar charts... thoth trader0204 Index Futures Trading 2 May 19th, 2014 08:49 AM
Strategy based on the Color of an EMA Line jhunt NinjaTrader Programming 1 November 21st, 2013 05:08 PM
Multi-Charts EMA strategy optimization Ryan26986 MultiCharts 8 May 11th, 2013 05:05 PM
Range Breakout Strategy stefan416 NinjaTrader Programming 3 January 9th, 2013 12:53 PM
MACD: The 12-period (EMA) minus 26 EMA emini_Holy_Grail Traders Hideout 1 February 22nd, 2010 12:04 PM

All times are GMT -4. The time now is 06:41 AM.

Copyright © 2016 by 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 2016-10-24 in 0.07 seconds with 19 queries on phoenix via your IP