MySAR ADX Trading System for Amibroker (AFL)

In a local database, which is not updated by a realtime plugin, the formula would get refreshed if we perform any actions, such as clicking, scrolling, zooming, changing parameters, choosing another symbol or interval, importing new data etc. To obtain such fills requires a quality minimum-delay data feed and advanced programming skills to implement trade-automation. The above statement is evaluated from left to right and would be an equivalent of:. The same formulas serve as indicators.

January 24, 2016

All system ideas presented here are unproven, unfinished, and may contain errors. They are intended to show possible patterns for further exploration. I prefer real-time systems that trade fast, are automated, and are devoid of traditional indicators.

Preferably, they should have no optimizable parameters; however, I may not always be able to meet this objective. The first system shown below is a copy of the demo system I use to develop Trade-Automation routines elsewhere on this site. To see how this works, you should Backtest it on 1-minute data with a periodicity in the range of minutes. Your first impression may be that these profits are simply due to an up market, however, the fact that Long and Short profits are about equal suggests there is more to it.

This reduces risk with respect to market exposure and gives you more time to enjoy other activities. Ticker names are omitted to keep the chart compact; the chart simply shows a net profit bar for each ticker tested.

Be cautioned that in its raw form the drawdowns are unacceptable and that there may be volume restrictions for many tickers. Since this system has low exposure, it may be a candidate for market scanning and ranked portfolio trading. However, price movement from different tickers may be correlated, and trades from different tickers may overlap.

If many tickers trade at the same time, it would be difficult to increase system exposure. Edited by Al Venosa. Filed by Herman at 1: This category is reserved for real working trading systems, i. Since the criteria for tradability varies from person to person, and since systems may work or not depending on how they are traded, it will be difficult to screen contributions here. With respect to what is posted here, keep an open mind and consider that the poster considers the system tradable. You can contribute by posting as an author requires registration or in a comment to this post.

Filed by Herman at This is where you can share trading systems that are marginally profitable, i. Such systems can often be improved by adding Stops, Targets, Money Management, Portfolio techniques, etc.

The reality is that while you may not have the expertise to make it work someone else may. Almost all of us find trading system ideas in books and magazines that we then code in AFL for evaluation. Some of these systems may have been around for many years while others are new ideas.

After coding them, almost always, we are disappointed and chuck out the system work! Instead of throwing out your work you are invited to post the system here to give another developer a chance to fix it. You are invited to contribute as an author requires registration or in a comment to this post. To further confirm this I added the opposite condition: The commentary window describes the technical situation in the given market conditions.

The commentaries are shown on the basis of formulas you wrote. The commentary also reflects buy and sell signals in graphical mode. With the use of AFL, traders can build their own in-house analytical program. What is Volume in Stock Market? How to Select Stocks for Intraday Trading? How to Enter and Exit in Intraday Trading? Day Trading Tips for Beginners.

Top 5 Mobile Apps for Intraday Trading. What is Technical Analysis of Stocks? How to choose right position size for your Trading? Why You Need a Trading Accounts? What is Supertrend Indicator? What is Algo Trading?

Algorithm Trading in India. What are the Best features of AmiBroker Software? Before building your strategies on AFL, test it on different time frames and symbols.

Make sure the results are matching with the original data you tested. Test the system on various market conditions. Last but definitely not least, we need to remember that AmiBroker may and will perform some executions internally for its own purposes such as:.

N-times during certain time-frame, because all really depends on the above factors, our actions and changing input. The AFL language contains many pre-defined words like: These are examples of constants. As written in AFL language specification http: Constants are tokens representing fixed numeric or character values. To better explain what this means, let us consider example of PI constant, which equals 3. PI is the name of constant we use this name in mathematical equations, because it is easier and more practical to use than using the numerical value each time.

Constants in AFL serve the same purpose, each of these words represents certain value properly interpreted by the program in the context they are used. Both commands are equivalent, because value of stopTypeTrailing constant equals 2 and value of stopModePercent constant equals 1, yet the first version is much more understandable. There is also another reason to use pre-defined constants rather than hard-coded numbers in the code. If for any reason the internal value of given constant changes due to development needs — all formulas using constants will continue to work properly because new version would interpret them properly , while hard-coded numbers may change the code execution.

TimeFrameSet in Weekly ; in the code, then such internal change does not really affect our formulas at all. There is one more example worth discussing — in the documentation of PlotShapes function we can find:. So — what does the multiplication mean in the above context? If we remember that constants are in fact just numbers, and boolean True in AFL has numeric value of 1, while boolean False has numeric value of 0, then:.

The above approach is kind of shortcut that saves using conditional statements. Otherwise the result of calculations would be different. The internal value of shapeUpArrow is 1 and ShapeDownArrow is 2, so in situation, where both Buy and Sell signals were true, we would get. That is why in general case it is better to use conditional function IIf, like shown below:. ADK contains instructions how to write your own AFL plugin along with code samples that are ready-to-compile.

ADK is freely downloadable from http: ADK is not for the beginners. It is for programmers i. We are working on providing alternative methods for non-programmers.

The error itself is described in the manual , but still a few words of explanation why it happens may be useful. The error usually occurs when formula uses hard-coded number of bars in the loop statements like this:. This all means that one should never make any assumptions on number of bars your formula would get, because if you do, the formula will fail.

The formula should be written so it is able to execute without errors with BarCount as small as 1 ONE. If your formula references past data, say bars earlier, you should start your loop with index 10, as below:. What to do if your formula, for some reason, really requires fixed number of bars?

Well, the answer is that you should check if you really get as many bars as you think:. Filed by Tomasz Janeczko at 4: A typical AFL function returns one value. For example sin x returns sine value of argument x. Returning multiple values is possible only via arguments passed by reference, but trouble is that in AFL all arguments are passed by value as in C language. Passing by value means that only value of variable is passed, not the variable itself, so original variable is not modified as shown in the example below:.

The behaviour shown above is desirable because we usually want the function to be opaque and do not interfere with what is defined outside of the function except for returning the result of the function.

Copyright © 2017 · All Rights Reserved · Maine Council of Churches