Creating a new function in Amibroker - AmiBroker | futures io social day trading
futures io futures trading

Creating a new function in Amibroker
Updated: Views / Replies:843 / 1
Created: by milkysahai001 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 100,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

Thread Tools

Creating a new function in Amibroker

Trading Experience: Beginner
Platform: MultiCharts, AmiBroker
Favorite Futures: Stock Futures
Posts: 42 since Sep 2016
Thanks: 17 given, 3 received

Creating a new function in Amibroker

i need to create a function MarketPosition in Amibroker, just like the one in MultiCharts. description in MultiCharts:
MarketPosition(N) returns whether the strategy is currently flat, short, or long on the current bar or for
N closed positions ago. MarketPosition return values are:
-1 for a short position.
1 for a long position.
0 for flat (no position).

I want to create same kind of function in Amibroker, but not good enough at coding.
Can somebody please help me do this.

paris france
Trading Experience: Advanced
Platform: Amibroker
Broker/Data: Interactive Brokers/IQfeed
Favorite Futures: Futures
Posts: 9 since Sep 2013
Thanks: 7 given, 5 received

This thread is old, but it's a classic so I answer it as it could be useful for other people.

Use the Flip() function. In the following I assume you have defined your system using variables Buy/Sell/Short/Cover.
If one of them is not defined, assign 0 to it e.g if you have no short position:
Short = Cover = 0; // no short positions

Now here's the solution to your problem:
MarketPosition = Flip(Buy, Sell) - Flip(Short, Cover);

Yes, it's a one-liner, that's the magic of AFL.

The following 2 users say Thank You to alligator for this post:


futures io > > > > Creating a new function in Amibroker
Thread Tools

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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a Function like NZ (TradingView) in AmiBroker AFL? milkysahai001 AmiBroker 2 February 24th, 2017 09:05 AM
Function for counting something in amibroker? fxtraders AmiBroker 2 October 24th, 2016 06:59 AM
How to use if() function to check value returned from cross() function vampirelord AmiBroker 4 March 28th, 2014 12:23 PM
Creating TrueFalse Function JGSmith EasyLanguage Programming 6 September 5th, 2013 10:05 AM
Creating a function to condense code brightredmegaphone NinjaTrader Programming 10 December 16th, 2010 11:27 PM

afl, amibroker, buy, code, coding, marketposition, multicharts, people, short, strategy, values

All times are GMT -4. The time now is 04:23 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business,
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 2019-06-17 in 0.18 seconds with 18 queries on phoenix