Oanda TDesk Drone Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 11

Installation Instructions
Oanda Configuration:
Create two accounts:
You will need two accounts. One for long trades and one for short trades.
1. Log in to your Oanda account (live or demo)
2. Select “Add Sub-Account”
3. Create two accounts. These must be v20 fxTrade accounts not v20 MetaTrader
4.
4. Name these accounts whatever you like but make note of the v20 account
number for each since you will need it later.
Sign up for API access:
The Python script will need access to the Oanda v20 API to perform trading activities.
1. Log in to your Oanda account (live or demo)
2. Under “My Servicesselect “Manage API Access”
3. Press the “Generate” button.
4. Copy down the API key that is generated.
MT4 Configuration:
Copy the necessary files:
Place the files that you downloaded in the necessary folders:
1. Open your data folder. This can be done by pressing the File dropdown at the
top of MT4 and then choosing “Open Data Folder”.
2. Navigate to the mql folder
3. Unzip the EA file and place the files from the image folder in to the image folder
here
4. Place the OandaTDeskDrone.mq4 from the Experts folder in the Experts folder
here.
5. Within MT4 in the Navigator panel right click Expert Advisors and choose
“Refresh”.
6. Verify that you can see OandaTDeskDrone listed. Otherwise double check the
steps above.
Create the FXtrade folder:
This is the folder that MT4 and the Python script both read and write to
1. Open your data folder. This can be done by pressing the File dropdown at the
top of MT4 and then choosing “Open Data Folder”.
2. Navigate to mql4/Files.
3. Create a new directory here named “FXtrade
Configure MT4 Notifications (Optional):
This is not necessary if you do not plan to enable notifications. I personally use this to
get notifications on my phone which are then sent to my watch.
1. Install MT4 on your Android/iPhone.
2. Within the phone app under the menu choose “Messages”
3. At the top you will see a button that says “MQID”. This will provide you with the
MetaQuotes ID number that you will need.
4. Go back to MT4 on your PC.
5. Open MT4 options. This can be done by pressing the Tools dropdown at the top
of MT4 and then choosing “Options”
6. Select the “Notifications” tab.
7. In the box that says “MetaQuotes ID” enter the the code that you got from the
Android/iPhone app.
8. Press the “Test” button. If you received the notification on your phone it is
configured correctly. Otherwise, double check the steps above.
Python Configuration:
Install Python 3 (Skip if Python already installed)
This script was written using Python 3. You can check if you already have it installed by
using command line and typing “python --version”. If it returns Python 3.x.x you can skip
this step.
1. Open a web browser and go to https://www.python.org/downloads
2. Press the “Download Python 3.x.x” button
3. Run the Python installation program that you just downloaded
4. IMPORTANT: When the installation program first opens, select “Add Python 3.x
to PATH”.
5. Press “Install Now” and complete installation.
6. Open Command Prompt. The easiest way that I know of to do this is to hold the
windows key on your keyboard and press R. This will open the Run Dialog.
Type cmd and press enter.
7. Within Command Prompt type python --version if you see Python 3.x.x python
is ready to use. Otherwise, double check the steps above.
Install necessary Python packages
There are a few packages that need to be installed.
1. Open Command Prompt. See step 6 above, if you need help.
2. Type the following, paying attention to capitalization, and press enter. pip install
oandapyV20 requests six
Configure the Python Script
Your API key and account details need to be entered in the Python script for it to
function correctly.
1. Unzip and copy the contents of the PythonMT4Bridge.zip file downloaded to a
folder of your choosing.
2. Open the static.py file in your preferred file editor. If you do not have a
preference, open it with notepad. Note: A word processor such as MS Word is
not acceptable for this.
3. Within the quotes where it says filepath = “C:\\Path\\to\\mql4\\Files\\FXtrade\\”,
replace with the path to the FXtrade directory that you created in the Create
FXtrade Folder step above. Follow the same format, noting the double
backslashes and ending backslashes.
4. Within the quotes where it says short_account_id = “000-000-0000000-000”,
replace with the account number of the account that you would like to use for
short trades.
5. Within the quotes where it says long_account_id = “000-000-0000000-000”,
replace with the account number of the account that you would like to use for
long trades.
6. Within the quotes where it says token = “000….-000…”, replace with your API
token from the Sign Up for API Access step above.
7. On the line where it says live_trading = False, leave it set to False if you are
using a Demo account or change it to True if you are using a Live account.
Verify that the Python script is configured correctly
If everything is configured correctly you should not get any errors.
1. Open Command Prompt. See step 6 in the Install Python 3 step above, if you
need help.
2. Navigate to the folder where you installed the Python script.
3. Type python MT4BridgeV20.py and press enter.
4. If you see UPDATE ACCOUNT: Success and the same message about
UPDATE POSITIONS, then continue. Otherwise double check the steps in this
section and the other python sections.
5. In MT4, open your data folder. This can be done by pressing the File dropdown
at the top of MT4 and then choosing “Open Data Folder”.
6. Navigate to mql4/Files/FXtrade.
7. There should be an alive_check file, an account-short.txt file and a account-
long.txt file. There may be other files if you already have trades open within
either of these accounts. If the files are there you are good, otherwise, double
check the steps above.
Running The EA
1. Start the Python script by opening Command Prompt, navigating to the folder it is
in and typing python MT4BridgeV20.py followed by enter.
2. Start and configure TDesk. Let it finish loading.
3. Start and configure the OandaTDeskDrone EA
4. Pay attention to the Current Status at the bottom of the dashboard to verify that it
is active and looking for trades.
Dashboard Functions
Pressing the button will open the chart for the listed pair.
Pressing the button will toggle between automatic and manual trading. When in
manual trading mode the pair will not be managed by the EA, so this is an easy way to
pause a pair.
In manual trading mode the and buttons will open trades with lot sizes
defined in the EA settings.
In manual trading mode if trades are open this button will close short trades,
while this button will close long trades.
In manual trading mode if a hedge trade is open this button will close the trade.
A hedged trade is indicated by with the box on the side of the H denoting the hedge
trade.
EA Properties
Dashboard Settings
When to allow new trades
“At New Candle” timeframe
Timeframe for At New Candle setting above.
Offset to Adjust Short P/L Reported by Oanda
This will adjust the Short P/L displayed in the dashboard by the defined negative or
positive offset you define here. This has no effect other than to change the P/L
displayed amount.
Offset to Adjust Long P/L Reported by Oanda
This will adjust the Long P/L displayed in the dashboard by the defined negative or
positive offset you define here. This has no effect other than to change the P/L
displayed amount.
When AutoTrading button is pressed:
Every Tick:
Trades can be opened any time a signal is received
At New Candle:
Trades are only opened when a new candle opens.
Pause Opening New Trades:
Pause all Trading Activity:
Notifications
Notify of Warning Messages?
Send notifications for EA warnings. Such as the Python script not working or TDesk not
running.
Notify When Opening Trades?
Send a notification when a new trade is opened.
Notify When Closing Trades?
Send a notification when a trade is closed.
Hour Notification Start (local time)
The starting hour in local time when notifications are allowed to be sent. Notifications
will not be sent before this hour.
Hour Notification End (local time)
The ending hour in local time when notifications are allowed to be sent. Notifications will
not be sent after this hour.
Signal Settings
Seconds Between TDesk Signal Checks
Interval in seconds to check for new TDesk signals. Adding a delay will help avoid
rapidly changing signals.
Minutes to Consider Signal Valid
Maximum age for a TDesk signal to be considered valid. Primarily used when restarting
the EA.
Lot Calculations
Lot Calculation Method
Fixed: Lot Size (1000 = 0.01)
Lot size in Units for every trade.
Risk: Avg Loss in Pips
Used in the Risk Based lot calculation. The average loss size to be considered in the
calculation.
Risk: Percent Risk per Trade
Used in the Risk Based lot calculation. The amount of risk for each pair based on it’s
percentage of account balance. For example, if the account balance is $1000 and you
are trading 10 pairs, then 2% risk here would be risking $2 ($1000 / 10 * 0.02). NOTE:
This is just an estimate for lot calculation purposes. Trades will not automatically close
at this risk level.
Risk/Max: % Acct Balance Not Used in Calculations
When performing lot calculations, the amount of the account balance to not consider.
For example, it you had an account balance of $1000 and chose 20 here then $800
would be considered when calculating lot sizes. ($1000 minus 20%).
Risk/Max: Max Num Trades/Pair for Calculations
The maximum number of trades per pair to be used when calculating lot sizes.
Increment the Size of Each Trade?
Allows for the closure of trades without consideration of U.S. FIFO rules. So long as
trades are all of different sizes Oanda allows for them to be closed in any order.
Increment Amount
The number of units to increment each consecutive trade by. I recommend incrementing
by 1 unit, since there is no benefit to incrementing by more.
Fixed Lot Size:
Every trade is opened with the same lot size in units.
(1000 units is the same as 0.01 in MT4)
Risk Based:
Calculate lot sizes for each pair using U.S. margin
requirements, size of the average loss in pips and the risk
for that pair based on it’s portion of the account balance.
Max Lot Size:
Calculate lot sizes based on U.S. margin requirements and
the maximum usable margin per pair.
Trade Entries
Max Trades Allowed Per Pair
The maximum number of trades allowed per pair at one time. This number does not
include any hedge trades.
Min Pip Distance Between Trades
The minimum number of pips above the highest trade or below the lowest trade required
to open a new trade.
Min Margin Level to Trade (0 = disable)
If the margin level falls below this level no new trades will be open. A setting of 0 will
disable this functionality.
Max Number of Pairs to Trade (0 = disable)
The maximum number of pairs allowed to have open trades at one time. If this number
is met no new trades will be opened.
Trade Exits
Close Trade on Opposite Signal?
When an opposite signal is received close the trade. For example, if a trade was
opened with a LONG signal and a SHORT signal is received, close the trade.
Close Trade on Flat Signal?
When a signal changes from LONG or SHORT to FLAT, close the trade.
Use Margin Level Closure?
Close all trades when the minimum margin level is exceeded.
Close Below Margin Level
The margin level at which a margin level closure will occur.
Use Combined Margin from Both Accounts
If one account has triggered a margin level closure, close all trades on both accounts.
Profit Close Level (0 = disable)
(Copied from Desky User Manual) The cash profit to lock in when closing /deleting all
trades. A zero value turns this off, so enter 0.01 as the nearest equivalent to zero. A
negative figure represents an acceptable loss.
Pip Close Level (0 = disable)
(Copied from Desky User Manual) The pips profit to lock in when closing /deleting all
trades. A zero value turns this off, so enter 1 as the nearest equivalent to zero. A
negative figure represents an acceptable loss.
Hedging
Hedge on Flat Signal
If a trade is open and a signal changes to FLAT, open a hedge trade.
Hedge on Opposite Signal
If a trade is open and an opposite signal occurs, open a hedge trade.
Close Hedge on Opposite Signal
If a hedge trade is active and a signal is in the direction of the original trade then close
the hedge.
On Signal Reversal Keep Profitable Hedge
If a hedge trade is active, in profit and a signal occurs in the direction of the hedge, keep
the hedge open and close the originating trade.
Minimum Seconds to Reopen a Hedge Trade
Number of seconds required between a hedge trade closure and the opening of a new
hedge trade on the same pair in the same direction.
Percentage of Trade Size to Hedge
The percentage of the pair position size to hedge.
Trading Hours
Hours to Allow Trading
(Copied from Desky User Manual). This is fantastic functionality provided by Baluda.
Sort these out for yourself, using the information here. Never ask questions about
it in my threads. You will regret doing so should you ignore this warning.
use the 24 hour clock format.
Enter trading periods in your broker's server time; use the EA's time display at
the top of your chart to work out the difference between your broker and your
local time.
Enter as many trading times as you want:
o precede trading start times with a '+' e.g. +08.00
o precede trading stop times with a '-' e.g. -13.15
o separate each value with a comma. Do not leave spaces.
o An example. Imagine you want to trade between 7 and 11 am and 1 and
5.30 pm, your input will look like this:
+07.00,-11.00,+13.00,-17.30
Trading Days
Friday Stop Trading Hour
The hour in 24 hour local time to stop trading on Friday. For example, if the hour is set
to 14, no new trades would be taken after 1:59 PM.
Friday Close All Trades Hour
The hour on Friday, in 24 hour local time, to close all open trades regardless of profit or
loss.
IMPORTANT NOTE: If this is set to the same hour that Oanda closes trading it will not
trigger.
Trade on Sunday?
Do you want to allow the EA to take trades on Sunday when the market opens?
Monday Start Trading Hour
If you have chosen to not take trades on Sunday, this is the hour in 24 hour local time
that trading will begin on Monday. If you have chosen to allow trading on Sunday this
setting has no effect.
Trade on Thursday?
Do you want to allow the EA to take trades on Thursday? Thursday is considered by
some to be a bad day to trade since it is often times a market reversal day.
Trading Filters
Balancing: Use Zeljko Filter?
(Copied from Desky User Manual). Named after Zeljko who corrected the code for this
filter and made it work. This filter ensures 'balanced' trading. The easiest way to describe
it is to use hypothetical trades. Imagine that:
this EA buys GBPUSD.
this EA buys GBPJPY. You are now heavily exDeskyed to GBP.
Something unexpected happens (and something unexpected always happens in
Forex) and the pound plummets, dropping like a stone into the abyss. Both your
trades scream into huge drawdown.
To avoid this, having taken the GBPUSD trade, this EA will not buy another
GBPxxx pair. Imagine instead that a Sell GBPJPY trade arises, just before the
market plummets. This time, your GU trade is screaming into the abyss, but your
GJ trade is going stratospheric. One trade 'balances' the other in the event of
something dramatic happening
Balancing: Only Trade Currency Twice
(Copied from Desky User Manual). works in conjunction with Balancing: Use Zeljko
Filter?. Again, imagine the above scenario nos 1 & 4. Now you have a GU Buy and a GJ
sell open perfectly balanced trades. If you now further trade any pair involving GBP,
you will unbalance your trading again, leaving you exposed to unexpected events. This
filter prevents a third trade being opened involving GBP.
Note: both UseZeljco and OTCT work more deeply than the example I have just
given. For example, now you have a GU buy open, balanced trading does not
allow a further buy xxxUSD trade to open, only a sell xxxUSD then OTCT kicks
in again........... Got a headache yet?
Swap: CAD Positive Only
Only allows trading CAD pairs with positive swap.
Swap: AUD Positive Only
Only allows trading AUD pairs with positive swap.
Swap: NZD Positive Only
Only allows trading NZD pairs with positive swap.
Swap: Only Trade Positive Swap
Only allows trading pairs with positive swap.
Shirt Protection
Use Shirt Protection?
(Copied from Desky User Manual). We have a saying in the UK; “He gambled, and lost
his shirt”.
In other words, lost everything. This EA has a global stop loss applied to the entire
position, and will close all the trades it is managing if their combined loss reaches this
stop loss.
Maximum Allowable Loss
(Copied from Desky User Manual). This the maximum acceptable draw down that you
can tolerate before closing all trades. Do not worry if you forget to input this as a
negative number; This EA will convert it for you.
Including non TDesk compatible indicators
(Copied from Desky User Manual). This is still possible but you do need to understand how to
use the iCustom() call. You would insert the call/s after Desky had read TDesk's signal and
before sending a trade.
Do a search in the .mql file for, //Note to coders adding non TDesk compatible indicators.
Here is where you would put your iCustom call.” and insert your calls as shown.
Disclaimer and Risk Disclosure
Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all
investors. The high degree of leverage can work with as well as against you. Before deciding to
invest in foreign exchange you should carefully consider your investment objectives, level of
experience, and risk appetite. The possibility exists that you could sustain a loss of some or all
of your initial investment and therefore you should not invest money you cannot afford to lose.
You should be aware of all the risks associated with foreign exchange trading, and seek advice
from an independent financial advisor should you have any doubts.
I will put this a tad more bluntly:
Most Forex traders lose all their money.
Using this EA in trading Forex does not guarantee success.
Trading with this EA could lead to serious financial loss.
Trading this EA without understanding its underlying what TDesk does
guarantees traders will lose their money.

Navigation menu