Skip to main content

Posts

Showing posts from August, 2018

FX Algotrading Q&A Session 16/08/2018

On the 16th August I delivered a webinar on the topic of "introduction to FX Algotrading". In this 40 minutes I introduced myself, the strategies I am running and the platform I am using.

Here is the replay:


Toggling the Auto Trading Button in MQL4

Introduction

In this post, I will introduce an MQL4 code I use to control remotely the auto trading button on/off status, this code is part of the RemoteControl library product available for purchase here.

There are some scenarios where we would like to stop trading completely such as:


Extreme market conditions or
Below a certain equity threshold.
Negative P&L below a certain threshold.


But when we are not near the PC, this could be a challenging task to do. We can either close all of our positions and take some loss, or, let the positions run and hope for the best…

In this post, I will introduce a code snippet which you can plant in your code, which upon certain conditions can mimic halt trading by toggling the auto trading button on / off:



So, upon executing this code, the button will be toggled between on and off, and you will get notified about the new state.

Implementation

First of all, we need to modify the WinUser32.mqh which is shipped as part of the MetaEditor installation, by addi…

Linear Hedging Framework for MQL4

Introduction

When opening an order, we are all hoping that our analysis was correct and our position will make a profit. But, when this is not the case, there are in general three possibilities to continue:


Close the order upon a predefined stop-loss, if we were able to close the order on the opening price, then it's even better and no harm was done - The challenge with this approach is to know where to set the stop loss point, not to make too tight so it doesn't get hit quick, or too wide and then the loss is massive.
Let the order run and hope that at some case the trend will reverse and our analysis was correct - Challenging as well, since we will never know with 100% accuracy that this level will be reached again, so in the meantime our P&L gets more and more negative and we make loss on the swap if it is against us.
Hedge the order - meaning opening an opposite order upon a predefined gap and close it once the orders cancel each other profit wise.


I will dedicate this post…