Luna AI PRO manual

4 July 2023, 09:01
Profalgo Limited
2 977




How to set up the EA:


First make sure to add the following 2 URL’s to the MT4/MT5’s settings (Tools -> Options -> Expert Advisors -> Allowed URL’s):




These are necessary for the news filter, and Auto GMT to work properly.


It is highly recommended to run the backtests in MT5.  That way, you’ll have backtesting up to 100% quality tickdata with variable spread.  That will be closest to the real live trading.  (For good historical data quality, I recommend using Alpari broker on MT5.  You can use a demo account for that.  They have some of the most reliable historical data)

Also, MT5 allows to run all pairs together in 1 test, so you can see the results of the portfolio when using automatic lotsize much  better.

·       Run the test on EURUSD M5

·       Enable the OneChartSetup in the parameters

·       Set your lotsize (see below for different risks)

·       For MT4: run all pairs individually (no OneChartSetup as it doesn’t work in MT4 backtesting)


Running live:

A) With OneChartSetup enabled:  Simply run the EA on a EURUSD M5 chart with OneChartSetup enabled.

B) With OneChartSetup disabled: Run the EA on a M5 chart for each of the 8 optimized pairs.


Make sure you select your lotsize setup.  for USD/EUR nominated accounts, these are the risk levels for LotsizeStep:

- 400 -> low risk

- 200 -> Medium risk

- 100 -> High risk

- IMPORTANT: If your account is valuated in another currency (like JPY), you must convert these values first!! (using USDJPY quote of 130.00 for example, the values would be 52000 for low risk, 26000 for medium risk and 13000 for high risk)


For MT5: when you receive an error regarding the Bollinger Bands indicator: make sure you have all the pairs visible in the marketwatch window, and that they all have some historical data. Also make sure you are running on the correct symbols.  Some broker use symbols with a suffix, like for example EURUSD.m.  So you must run on a chart with that symbol/suffix.



Parameter list:

ShowInfoPanel: enable the information panel on the chart

Adjustment for InfoPanel size: for 4K screens, use value "2" to correctly display infopanel

Update infopanel during testing: disabled will run backtests faster

comment: comment of the trades

- Magicnumber: the magicnumber used by the EA.  this can be the same for all pairs

OneChartSetup: enable the OneChartSetup (run all optimized pairs from 1 single chart)

OneChartSetup_Pairs: pairs to run (only optimized pairs can be used here).  Currently, the EA runs best on these pairs on these pairs: EURAUD;EURCAD;EURCHF;GBPCHF;AUDUSD;AUDCAD;EURGBP;GBPAUD;





Time to Start: Time to start the trading session, based on GMT+2 (winter and US DST), assuming rollover at 0:00.  And this is brokertime (marketwatch window)

Time to Stop:   Time to stop the trading session, based on GMT+2 (winter and US DST), assuming rollover at 0:00.  And this is brokertime (marketwatch window)

Allow Trades on Friday evening: Allow the EA to open trades on friday evening right before the weekend

Allow Trades on Weekly Market open: when enabled, the EA will also trade the first hour when market opens after the weekend.

Skip trading on US holidays: this will disable the EA on US holidays, which are low in liquidity and best to avoid for night scalping



Max spread allowed before settings trade: the maximum spread allowed before entering a trade

spread at which pending orders are deleted: self explanatory

Maximum number of correlated trades (0=disabled)): Here you can limit the occurance of correated pairs trading in the same direction.  For example: Buy EURUSD and Buy EURCAD are correlated on EUR.  But Buy EURUSD, and Sell USDCHF are also correlated on USD.  A good value for this parameter is "3".

- Trade at Weekly Market open

Use Market Orders for Entry: by default the EA will use "Limitorders", but some brokers don't like the multiple opening and modification of pending orders.  You can use this option if your broker starts giving your warnings about that.

- Force Marketorder if limitorder is out of range: this will set an immediate marketorder, if the limitorder can not be place because it is higher than the buy price, or lower than the sell price



- SetSLTP_AfterEntry: this will make the EA wait until the trade is in the market, before setting SL and TP.  This might prevent strange SL/TP on trades that have big slippage

Add X pips to TP level:  It will a X pips to the default TP levels






- Skip trading on Triple Swap: this will disable trading before the triple swap (usually wednesday night).  I personally don't use this option

TripleSwap day: here you can override the Automatic detection of TripleSwap Day

Maximum SwapCost allowed (in points): (value "0" means disabled).  Here you can set a value of the maximum swapcost (in points, for example "-5") that you want to allow before setting a trade.




Enable News Filter: set to "true" to use the news filter

FilterHighRisk: filter out high impact news

FilterMediumRisk: filter out medium impact news

FilterLowRisk: filter out low impact news

FilterAUDonJPYnews: filter trades on AUD pairs when JPY has news coming out

HoursBeforeTradingSession: check news X hours before the trading session starts

HoursAfterTradingSession: check news X hours after the trading session has ended



Autolotsmode: here you can choose if you want to use a fixed lotsize (StartLots), or use the LotsizeStep, or use the Risk Per Trade (LotsizeStep is recommended)

StartLots: the lotsize used for fixed lotsize

Risk Per Trade: the risk per trade in %.  Lotsize will then be based on SL of the pair and the risk chosen

LotsizeStep: the EA will use X lots per Y balance.  for example: LotsizeStep=100 means the EA will use 0.01lots per 100 of balance.  so on 500 balance, it will be 0.05lots.  Keep in mind that these values need to be adjusted to your base currency!  So when running on JPY account, you can not use value 100, since that would be much too high in lotsize!

OnlyUp: this will force the EA to only increase lotsize after profits, but not reduce lotsize after losses (for faster recovery). Example: if you use LotsizeStep=100, the EA will use 0.01lots per 100 of balance. so if you balance is 500, it will use 0.05 lots. It the balance grows to 1000, the lotsize is 0.1lots. If balance then declines back to 700, the lotsize will remain 0.1lots if OnlyUp is true

Balance selection for Autolotsize Calculations: here you can choose if the EA should use Balance or Equity for automatic lotsize calculations

Split up trade into X smaller trades: with this option, you can force the EA to set multiple smaller trades instead of 1 big trade.  This might help with slippage issue when trading big lotsizes.

Split up trades based on max Lotize Y: here you can set the maximum lotsize per single trade.  If the lotsize will be bigger, the EA will split up the trade into multiple part.  This is to improve execution of big lotsize trades





- Enable Performance based Lotsize: this will turn on this feature.  The feature will limit the lotsize of pairs that are not performing well.  And when they are performing good  again, it will again increase the lotsize.

- Performance numbers to use: you can select to see results based on real numbers (absolute values of profits and profit per trade), or by normalized number (reduced to lotsize 0.01 to have better direct comparison between the pairs)

- How to rank pairs: you can select to rank the pairs by profits, or by profit per trade

- Number of days to evaluate: here you set the minimum days of history for the pairs the EA needs, to evaluate before starting to adjust the lotsize

Days of profit to reset lotsize: The lotsize will be reset to normal, if this short term period is positive (when "Only limit pairs in minus" is enabled)

- minimum #trades before monitoring: here you set the minimum number of trade of the pairs that the EA needs to take in accounts

- Maximum lotsize reduction: the maximum (in %) to reduce the lotsize, based on his ranking place

- Only limit pairs going in minus: this will make the EA only reduce lotsize for pairs that have a negative performance (so profits in minus or profit per trade in minus



AutoGMT: this will make the EA automatically calculate your broker's GMT settings. (make sure to add the URL """ to the list of allowed URLs in your MT4/MT5) 

GMT offset Winter: when AutoGMT is disabled, set this value to the winter GMT offset of your broker

GMT offset Summer:  when AutoGMT is disabled, set this value to the summer GMT offset of your broker




Pairs to use Rollover filter on: Here you can set which pairs that will be not be trading during rollover

Rollover start time: time when rollover starts (always based on GMT+2 winter and GMT+3 summer so your do NOT need to adjust to your broker's GMT)

Rollover end time: time when rollover ends (always based on GMT+2 winter and GMT+3 summer so your do NOT need to adjust to your broker's GMT)