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:382 / 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 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
 

Creating a new function in Amibroker

  #1 (permalink)
Trading Apprentice
Agra+India
 
Futures 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.

Reply With Quote
 
  #2 (permalink)
Trading Apprentice
paris france
 
Futures Experience: Advanced
Platform: Amibroker
Broker/Data: Interactive Brokers/IQfeed
Favorite Futures: Futures
 
Posts: 8 since Sep 2013
Thanks: 4 given, 4 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:
 
Code
Short = Cover = 0; // no short positions

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

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

Reply With Quote
The following user says Thank You to alligator for this post:

Reply



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

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

RandBots: AutoTrading Bots to diversify your trading

Oct 24
 

TopstepTrader: Profiting Without Risking Your Own Money

Oct 26

Building Open Source Indicators for NT8 w/Fat Tails @ Lizard Indicators

Elite only
     

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


All times are GMT -4. The time now is 09:39 AM.

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-10-23 in 0.05 seconds with 22 queries on phoenix via your IP 54.81.110.114