SimpleFX - Margin Trading Made Easy

Auto-trading fun with Bollinger bands [Novice level].

Whilst we have a fair few 'novice' posts about TA and Global Macro (aka "Fundamentals"), there aren't too many involving auto-trading. Seeing as I'm in the middle of teaching myself MQL4, I thought I'd throw this out there as discussion prompter.
By "novice", I mean someone who has moved beyond complete beginner ("what's a FOMC and a NFP?") but still not deploying robust and market ready strategies ("how does market structure affect news event response?"), so constructive criticism, informed commentary or taking the ideas and developing them further are very much the point of sharing in the first place. It's not meant to be a showcase of code, because the code is a mess!
This post got me thinking about how relatively trivial it would be to implement a Bollinger Band mean reversion autotrader.
Project Goals
My interest in the project was as a way to begin development of a skeleton EA that would use a custom indicator to implement trade signals. The point of this would be to allow for faster prototyping of visually based autotrading before taking it to the testing environment. The key advantage of this is that you can see on your charts which entries are being missed, something that is much more laborious to do via visual mode in the strategy tester.
Concept Development
So to begin the project, I sketched out the concept.
One way to trade Bollinger Bands is to trade the reversion to the mean. Intuitively, we expect that wider deviations from the mean will result in more reliable reversions to the mean. To explore this we could enter when price breaches the second SD band and then returns back inside it.
Here's the default Bollinger Band on default settings in MT4, demonstrating this sort of behaviour:
http://i.imgur.com/dK2oDO7.png
Prototyping
I want to use the indicator, and not the EA, to generate trade signals, as this is the point of the project for me. Because I'm lazy and grew up coding in basements, I opt to fiddle with the default indicator code rather than build up from scratch.
My first goal is to add two things.
Firstly, I want to add another layer of bands, because I saw a set up like that a while ago and liked it. (This is not a very good reason, and I think it costs me down the track).
Secondly, I want to add in a way to visually indicate the trade signals before we pass them to the EA.
Adding another set of bands is just a copy and paste of the existing bands. My learning point here is that I need to adjust the amount of buffers to match the number of bands I want. This comes into play for adding the trade signal arrows, as they need to go in the same sort of structure as the second lot of bands.
[I know from reading about the project goals in advance that EAs access custom indicators via iCustom(). This function can only receive the contents of one of the first 8 indicator buffers. Thus the idea will be that the buffer that marks out the trade entries on the indicator will later be used by the EA to mark out where entries should be. It's possible this is not the best way for EAs to access custom indicators , so input from more experienced coders is welcome!]
#property indicator_chart_window #property indicator_buffers 8 // <---- have to set this to match your copy and pasted buffer amount #property indicator_color1 LightSeaGreen #property indicator_color2 LightSeaGreen #property indicator_color3 LightSeaGreen // hack in (make 'em colourful. Turns out I didn't understand how the numbering worked, and indictator_color4 is never visualised) #property indicator_color4 clrWhite #property indicator_color5 clrWhite #property indicator_color6 clrRed #property indicator_color7 clrGreen #property indicator_color8 clrRed //--- indicator parameters input int InpBandsPeriod=50; // Bands Period input int InpBandsShift=0; // Bands Shift input double InpBandsInnerDeviations=1.0; // Add in for our other Band input double InpBandsOuterDeviations=2.0; // Bands Deviations //--- buffers double ExtMovingBuffer[]; double ExtUpperBuffer[]; double ExtLowerBuffer[]; double ExtStdDevBuffer[]; // hack in buffers (these buffers will store our trade signals) double SellSignalBuffer[]; double BuySignalBuffer[]; // these buffers will hold the additional bands. apologies for the naming, I didn't originally intend to share this double ExtUpperUpperBuffer[]; double ExtLowerLowerBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { //--- 1 additional buffer used for counting. IndicatorBuffers(8); // don't forget to adjust this to account for the new buffers IndicatorDigits(Digits); //--- middle line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMovingBuffer); SetIndexShift(0,InpBandsShift); SetIndexLabel(0,"Bands SMA"); //--- upper band SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtUpperBuffer); SetIndexShift(1,InpBandsShift); SetIndexLabel(1,"Bands Upper"); //--- lower band SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtLowerBuffer); SetIndexShift(2,InpBandsShift); SetIndexLabel(2,"Bands Lower"); SetIndexBuffer(3,ExtStdDevBuffer); //--- Copy and paste from above, and just change the number! Upper outer band is INDEX 4 SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,ExtUpperUpperBuffer); SetIndexShift(4,InpBandsShift); SetIndexLabel(4,"Bands Outer Upper"); //--- Copy& paste, lower outer band is INDEX 5 SetIndexStyle(5,DRAW_LINE); SetIndexBuffer(5,ExtLowerLowerBuffer); SetIndexShift(5,InpBandsShift); SetIndexLabel(5,"Bands Outer Lower"); //--- remind myself which is which so I don't forget later: sell signal is INDEX 6!!!! SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,218); SetIndexBuffer(6,SellSignalBuffer); SetIndexShift(6,InpBandsShift); SetIndexLabel(6,"Sell Signal"); //--- buy signal is INDEX 7 !!! SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,217); SetIndexBuffer(7,BuySignalBuffer); SetIndexShift(7,InpBandsShift); SetIndexLabel(7,"Buy Signal"); //--- check for input parameter if(InpBandsPeriod<=0) { Print("Wrong input parameter Bands Period=",InpBandsPeriod); return(INIT_FAILED); } //--- SetIndexDrawBegin(0,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(1,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(2,InpBandsPeriod+InpBandsShift); // hack in our additional buffers, so they also start at the corect point SetIndexDrawBegin(4,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(5,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(6,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(7,InpBandsPeriod+InpBandsShift); //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Bollinger Bands | //+------------------------------------------------------------------+ // all of this code is from the default indicator int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i,pos; //--- if(rates_total<=InpBandsPeriod || InpBandsPeriod<=0) { return(0); } //--- counting from 0 to rates_total ArraySetAsSeries(ExtMovingBuffer,false); ArraySetAsSeries(ExtUpperBuffer,false); ArraySetAsSeries(ExtLowerBuffer,false); ArraySetAsSeries(ExtStdDevBuffer,false); // hack in to make sure our custom buffers run in the same direction ArraySetAsSeries(SellSignalBuffer,false); ArraySetAsSeries(ExtUpperUpperBuffer,false); ArraySetAsSeries(ExtLowerLowerBuffer,false); ArraySetAsSeries(BuySignalBuffer,false); ArraySetAsSeries(close,false); ArraySetAsSeries(high,false); ArraySetAsSeries(low,false); //--- initial zero if(prev_calculated<1) { for(i=0; i1) pos=prev_calculated-1; else pos=0; //--- main cycle for(i=pos; i After a bit of tweaking typos, the indicator now displays two sets of bands, one at 1x SD and one at 2xSD from the mean (moving average). It also has two buffers that will use the DRAW_ARROW style to mark out potential trades.
Adding trade logic
I still can't decide if it's better to isolate the logic code in the Custom Indicator or the EA, in the long run. There seem to be performative, stylistic and redundancy issues, but for the moment the project is to put the logic in the Indicator, so that's what I did.
The fastest way to prototype this idea seems to be identifying when price closes outside of the far band.
This is trivial to achieve. We compare the close to the two outer bands, and if it's outside them, then we set the relevant trade signal buffer.
//
 double tempclose = close[i]; if(tempclose>(ExtUpperUpperBuffer[i]+10*Point)) { SellSignalBuffer[i] = high[i]+(20* Point); } else { SellSignalBuffer[i] = 0; } if(tempclose<(ExtLowerLowerBuffer[i]-10*Point)) { BuySignalBuffer[i] = low[i]-(20*Point); } else { BuySignalBuffer[i]=0; } } 
It works!
http://i.imgur.com/Ak3UkkK.png
Green arrows successfully mark out possible sell entries where price closes above the top band, and red arrows mark out possible buy entries when price closes below the lower band.
The logic can be a lot more complicated than this obviously, but the point of my project is to develop the iCustom technique, rather than make a good autotrader.
Now it's time to switch to the EA.
part two to follow
submitted by alotmorealots to Forex [link] [comments]

[Simple Forex Tester] Multiple Timeframes cara instal simple forex tester di mt4 [Simple Forex Tester] Multi-Timeframe Training - YouTube How to use the Strategy Tester in MT4 for manual ... [Simple Forex Tester] MetaTrader 4 Setup Free Forex Trading Simulator - back tester - YouTube [Simple Forex Tester] MetaTrader 4 Setup [Simple Forex Tester] Using Simple Forex Tester [Simple Forex Tester] Program Demonstration

- Simple Forex Tester Simple Forex Tester Review The Simple Forex Tester is a software suite that hooks DIRECTLY into the most powerful Forex trading platform on the planet -- MetaTrader 4. In this video, I outline how to use the multi-timeframe portion of Simple Forex Tester to be able to open more than one timeframe as you are running your tes... This video covers how to download and install ... Product Name: Simple Forex Tester The BEST MT4 Based Testing Platform Click here to get Simple Forex Tester The BEST MT4 Based Testing Platform at discounted price while it’s still available… All orders are protected by SSL encryption – the highest industry standard for online security from trusted vendors. Simple Forex Tester […] Simulate your manual trading at any point in history on any currency pair you wish, and practice your trading without risking anything! Training Videos. Simple Forex Tester comes with a full and complete set of educational videos, recorded by the software creator. These videos will guide you through every aspect of Simple Forex Tester, step by step to ensure you can get the absolute most out ... Description. Product Name: Simple Forex Tester The BEST MT4 Based Testing Platform Description: To See Simple Forex Tester In Action. No matter what skill level you possess, Simple Forex Tester will allow you to leverage the most powerful Forex trading platform in the world to practice your systems and your trading…without risking a single dime! Simple forex tester is a secondary software application which allows back-testing directly inside a MT4 platform. Simple Forex Tester. Being the most popular forex trading platform, it would only make sense to have a back-testing secondary application which would work within MT4. And this simple forex tester2 0 is a preferred choice for many professional traders and brokers out there. Back ... We are excited to introduce Forex Tester 4, a powerful new way to get more from backtesting and Forex trading as a result. Finally, Forex Tester 4 is ready to use: with dozens of new features and loaded with 800+ new symbols! Enjoy the new level of backtesting with the historical news service, money management features, Visual Strategy Builder and many other useful settings. DOWNLOAD DEMO ... Simple Forex Tester works by “modifying” Strategy Tester to turn it into a manual trading simulation. This opens up Strategy Tester to it’s FULL potential to be way more than just a way to test automated systems. You can replay the market tick for tick at virtually any point in history with a high degree of accuracy, and place manual trades in this simulation just as if you were placing ... Forex trading is literally making trades of Simple Forex Tester Metatrader one currency Simple Forex Tester Metatrader for Simple Forex Tester Metatrader another at a specific price. Forex trading is one of the most popular forms Simple Forex Tester Metatrader of trading available today and accounts for roughly USD $4 trillion in economic activity on a daily basis. Crypto, forex, and indicies. No minimum deposits. Negative balance protection. Stop dreaming. Start trading! The simplest and the most powerful trading platform . START NOW . Deposit & Withdrawal Affiliates Features Cryptocurrencies MetaTrader 4 Applications API Terms & Conditions Support About Us Career Blog Widgets. Contact us [email protected] [email protected] SimpleFX Ltd ... Simple forex tester free Mt4 or metatrader four is still the most popular forex trading platform around. No matter the discharge of the fifth generation of this platform chain from metaquotes software program corp. The 4th version remains going sturdy with the aid of recording paid downloads even now.

[index] [15468] [13045] [26233] [93] [9251] [21409] [27417] [20621] [25374] [24130]

[Simple Forex Tester] Multiple Timeframes

In this video, I outline how to use the multi-timeframe portion of Simple Forex Tester to be able to open more than one timeframe as you are running your tes... This is a quick video tutorial on how to use the MetaTrader 4 Strategy tester as a manual training tool for learning Price Action. link download software : http://tradownload.com/results/simple-fx-tester.html This video runs down how to open Simple Forex Tester within your MT4 platform,and goes through the basics of some of it's uses For more information about Sim... Looking for a free manual forex MT4 back tester? http://trk.pepperstonepartners.com/SHR Pepperstone offers a free full functional trading simulator. For MT4 ... [Simple Forex Tester] Program Demonstration ... (the worlds most popular and completely free forex trading platform) Category Education; Show more Show less. Loading... Autoplay When autoplay is ... [Simple Forex Tester] MetaTrader 4 Setup - This video walks you through your MT4 setup process to make sure it is able to run Simple Forex Tester. For more i... This allows you to open up multiple charts and multiple timeframes (yep!) with Strategy Tester inside of MetaTrader 4, giving you a highly accurate playback style so you can trade multiple ... Before we can dive into Simple Forex Tester, we need to make sure our MT4 platform is set up to be able to "handle" it properly. Watch this video for more information. For more information about ...

https://binary-optiontrade.baostorel.ga