Sun EA Guide

Sun EA Guide

23 December 2021, 12:20
Arthur Hatchiguian
12 302

1. Introduction

Hello, my name is Arthur 🙋‍♂️
I am an independent French developer with a passion for finance.
Trader for years, I started developing trading algorithms a while ago.
Now I am a developer specialized in algorithm conception on MQL5.
I have created my own tools and indicators to stand out from everything else on the market today. I'm always trying to create something new.

Welcome to my guide for the expert-advisor Sun (and Golden Tree).

Sun is a major upgrade from my old Sun AI robot, almost everything is new. It has been built on ICMarkets data. So let's start from scratch. 

Sun is an EA designed for specifics pairs, so it is not recommended to use it elsewhere. The timeframe has no real impact on live trading but in order to have better test quality, the recommended timeframe is M1. Each SUN pairs as the same engine but use differents patterns, which makes each EA totally different from each other.

This EA requires an Hedge account (not working on netting account), leverage 1:500 recommended. 

This EA requires at least 1000MB of free RAM (a lots of indicators are used) per pair to work properly.
I do not recommend Sun for beginners. Be sure to understand how MT5 and this EA works before going live. 
Check the Metatrader5 user guide here:

Sun uses homemade indicators that differentiate it from anything else on the market. Its trading style makes it unique. 

It is a risky scalper, which uses grid and martingale in an aggressive way. The robot is composed of independent strategies that have lasted several years on the specific pair. As each cycle is independent, it is possible to have several at the same time. You can therefore define a maximum number of simultaneous cycles.

What is a cycle? A cycle is strategy with a signal, an entry and an exit.
Each cycle is independent, it has multiple orders, it has its own signal, its own TP and SL.


For small traders, it is even possible to define a number of active cycles depending on their current balance.
In order to manage risk more simply, it is possible to activate an integrated SL for each pattern or to use an SL based on account equity.

But be careful, for 0.01 initial lot, one cycle SL is equivalent to 100$. If you start with 100$, you might lose everything.

Before continuing, I want to remind you that Sun's backtests are good because they use patterns that have worked in the past. It is important to understand that backtests are only used to validate the veracity of the strategy. Nobody will ever give you an EA with 100% winrate on mql5. Otherwise they would be billionnaires in a few months and there is no point of selling it. I'm not selling a 100% winrate EA, I'm selling my time of research, my experience and my tool to achieve a good winrate ratio, but obviously the EA will hit SL, specially if the market conditions change. You should refers to the demo signals, not the backtest, if you want to have a look of the lives performances. When Sun EA hits a few cycle SL, I will update the patterns that have been unsuccessful in order to keep the EA up to date in accordance with market changes. It means that previous cycle SL will NOT be in your backtest but you will see it in my live signals. This is not a trick to hide the past result, but my way to keep the algo up to date. All my signals are public and you can subscribe for free with a demo account. Keep in mind that Sun is a high risk robot. 

You need to take a step back and consider that the goal of a trading bot is not to return a delirious profit. Remember that the best fund in the world has an annualized return of 66%, and this performance cost millions per year. Don't expect to get more than that without some risk on the table.

I also remind you that we live in extremely volatile times. Interest rate changes, shortages, geopolitics. These are factors have a strong impact on the market. Manage your risk carefully.

2. Inputs

Let's see the input list:

Sun Settings

  • Initial lot: Set the initial lot for a cycle. 
  • Maximum number of active cycle: Set the strict maximum of simultaneous active cycles. 
  • Use cycle stoploss (use_SL): If active, this will use the SL built into the cycle. Otherwise the EA will continue to open orders.
  • The EA can start a buy cycle: Allow the EA to open a new cycle of buy orders. If false, the EA will not open new a buy cycle but will still grid the active buy cycle. This parameter should stay to true.  
  • The EA can start a sell cycle:  Allow the EA to open a new cycle of sell orders. If false, the EA will not open new a sell cycle but will still grid the active sell cycle. This parameter should stay to true. 

Autolot Settings

  • Balance per initial lot [0=off]: Defines the initial lot of a cycle based on the balance. Set to 0 to disable this feature.

For example, if initial lot = 0.01, Balance per initial lot  = 1000, Maximum initial lot = 0.25. 

Initial Lot Balance per
initial lot
Current Balance Current Initial Lot
0.01 1000 750 0.01
1000 1000 0.01
1000 1550 0.01
1000 2000 0.02
1000 2550 0.02
0.01 1000 3000 0.03
1000 7550 0.07
0.01 1000 25050 0.25
0.01 1000 32000 0.25
  • Balance per cycle [0=off]:  Set the maximum active cycle based on the balance. Set to 0 to disable this feature.

For example, if number of cycle per balance = 200,  Maximum number of active cycle = 10. 

Balance per cycle Current Balance Current Active Strategy
200 195 1
200 200 1
200 355 1
200 400 2
200 455 2
200 800 4
200 1955 9
200 2025 10
200 4337 10
  • Maximum initial lot: Defines the maximum initial lot of a cycle.

Global Settings

  • Maximum spread allowed [0=off]: Set the maximum spread allowed to open a cycle. Set to 0 to disable this feature.
  • Account type: Set your account type to allow EA to better calculate TPs.
ECN Low spread & commission (raw)
Standard Larger spread & no commission
  • Display informations on chart: Show some informations on chart. Disabling this will improve the speed of the tests. 
  • Sun chart color: Change the color of the chart in a more sunny way.
  • Magic Number: Set the magic number. The magic number is very important. The EA will only interact with the orders that have this magic number. You have to use a different magic number than other active EA. I recommend to always use the same magic number for Sun.
  • Order filling type: You can modify the order filling type, more info here. It's recommended to use "auto".

Security Settings

  • Equity TP: Stop the EA if the equity exceeds this limit [0=off]: Set an equity TP. Set to 0 to disable this feature. For example, if you start with a 300 usd balance, you can set a target of 500 usd. If the equity goes above 500 usd, the EA will close all orders and stop the trading until you change this limit or withdraw your balance.
  • Equity SL: Stop the EA if the equity falls this limit [0=off]:  Set an equity SL. Set to 0 to disable this feature. For example, if you start with a 300 usd balance, you can set a stoploss of 100 usd. If the equity goes below 100 usd, the EA will close all orders and stop the trading until you change this limit or adjust your balance.
  • Drawdown SL: Close orders if the drawdown goes above this limit [0=off]:  Set an a drawdown limit in percentage. Value must be set between 0 and 100Set to 0 to disable this feature. For example, if you set a drawdown SL to 50%. If you have a balance of 1000$ and your equity goes below 500$, the drawdown is above the limit and all orders are closed and the EA will continue to trade. Note: The drawdown is the difference in % between your balance and your equity. It is not based on your previous balance, it uses the strict balance at the time of calculation.
  • Send security push notifications: Send a notification on your phone if a security is triggered. You need to have your device connected using this guide:

3. Updates

Sun will be updated over time. Adding new features but also updating the less efficient patterns.
When a new update is live, you will received a message on MQL5. I recommend to keep Sun updated.

If you have any ideas for features to include, please let me know. I don't promise to implement them, but I will be listening to you as much as possible.

4. Risks

Risk definition: a situation involving exposure to danger.

Sun uses past data to anticipate a high success rate, however the outcome is not guaranteed. Always remember that the market is unpredictable.

Past performances do not guarantee future performances.

Even though the USD is a stable currency, the world we live in now can bring many surprises, especially with rising inflation, interest rates, wars, shortages and risk of recession..
It is important to remember that this is a risky expert-advisor because it uses grid and martingales strategies.

It will obviously hit a cycle stoploss one day because nobody can predict the market.
If many cycles are opened against the trend, it will lead to a significant drawdown.
It is important to understand and manage your risk well.
On SUN, there are several ways to manage your risk: 

  1. Use the equity SL to maintain a safety line in case of a losing scenario.
  2. Use the Stoploss patterns to cut strategies when they go outside the bounds of the past.
  3. Use a number of strategy and initial lot suitable to the balance. 
  4. Use the drawdown security in order to close every orders if the drawdown is too high and restart cycles.

Based on 1:500 leverage, I recommend at very least $200 per cycle for an initial lot of 0.01.

Remember the rules: 

  • N°1:  Only invest what you can afford to lose.
  • N°2:   Secure your profits.
  • N°3:  Always have a stoploss.

Note:  For 0.01 initial lot, one cycle SL is equivalent to 100$.

If you start with 100$, you might lose everything.

If you have 10 cycles of 0.01 initial lot, you risk 10x1x100$ = 1000$

If you have 5 cycles of 0.05 initial lot, you risk 5x5x100$ = 2500$

5. Settings

There are many ways to manage your risk. I'll summarize it all in a table:

Using 1 pair only:

  Very high risk High risk Medium risk Low risk
Minimum Starting balance (more risk)
100 200 300 500
Recommended Starting balance 300 1000 3000 10000
Initial lot 0.01 0.01 0.01 0.01
Balance per initial lot 300 1000 3000 10000
Balance per cycle 100 200 300 500
Maximum initial lot 4 2 1 0.5
Maximum number of active cycle  5  10  20

You can adjust your risk by yourself or download setfiles at the bottom of this blog post. 
It is important to take into account the number of orders and the maximum volume allowed by your broker.
These values are based on ICMarkets properties, 200 lots maximum and 200 orders.

If you are using multi pairs on the same account, Multiply the Balance per initial lot & Balance per cycle by the number of pairs.

Very High Risk Set  1 pair 2 pairs 3 pairs 4 pairs 5 pairs   6 pairs
Minimum Starting balance (more risk) 100 200 300 400  500  600
Recommended Starting balance 300 600 900 1200  1500  1800
Initial lot  0.01 0.01 0.01 0.01  0.01  0.01
Balance per initial lot 300 600 900 1200  1500  1800
Balance per cycle 100 200 300 400  500  600
Maximum initial lot 4 2 1.25 1  0.8  0.65
Maximum number of active cycle 3 3
3  3  3
High Risk Set  1 pair 2 pairs 3 pairs 4 pairs 5 pairs  6 pairs 
Minimum Starting balance (more risk) 200 400 600 800  1000  1200
Recommended Starting balance 1000 2000 3000 4000  5000  1000
Initial lot  0.01 0.01 0.01 0.01  0.01  0.01
Balance per initial lot 1000 2000 3000 4000  5000  6000
Balance per cycle 200 400 600 800  1000  1200
Maximum initial lot 2 1 0.75 0.5  0.4  0.3
Maximum number of active cycle 5 5 5 5  5  5
Medium Risk Set  1 pair 2 pairs 3 pairs 4 pairs 5 pairs  6 pairs 
Minimum Starting balance (more risk) 300 600 900 1200  1500  1800
Recommended Starting balance  3000 6000 9000 12000  15000  18000
Initial lot  0.01 0.01 0.01 0.01  0.01  0.01
Balance per initial lot 3000 6000 9000 12000  15000  18000
Balance per cycle 300 600 900 1200  1500  1800
Maximum initial lot 1 0.5 0.3 0.25  0.2  0.15
Maximum number of active cycle 10 10 10 10
8  6
Low Risk Set  1 pair 2 pairs 3 pairs 4 pairs 5 pairs  6 pairs 
Minimum Starting balance (more risk) 500 1000 1500 2000  2500  3000
Recommended Starting balance
10000 20000 30000 40000  50000  60000
Initial lot  0.01 0.01 0.01 0.01  0.01  0.01
Balance per initial lot 10000 20000 30000 40000  50000  60000
Balance per cycle 500 1000 1500 2000  2500  3000
Maximum initial lot 0.5 0.25 0.15 0.12  0.1  0.08
Maximum number of active cycle 20 20 13 10  8  6

Don't forget to adapt the max spread for each pair.

6. Broker


7. VPS


8. Bug and errors

If you think you have an error or an issue with Sun, please send me a report on a private message.
I need, at least, a screenshot of your chart and your orders (with comment and magic number displayed)

I also need your journal and your expert log. 

With all this informations I might be able to help you fast.

If you don't have trade, check this step 1 by 1:

  1. Make sure your MT5 is running 24/7
  2. Check if you can read auto trading enabled
  3. Check if you have trade on the strategy tester with the same settings. If you don't have trade on tester, change the filing type and retry until you find the good one.
  4. Check the spread filter
  5. Check the VPS journal log to see if there is an error
  6. Check, if you are using rent, that your new license is activated on your MT5.
  7. Wait at least 1 day to let time to have a signal

9. FAQ (Frequently Asked Questions)

Feel free to send me your question in a private message, or in the comment section below.

1. you have write "at least need 1GB free RAM. how to check it? is it mean 1GB RAm vps only can run 1 chart? also how to check if the EA not work properly?

- Hi you should have the information on your VPS. Otherwise check the task manager as display on this guide Yes 1GB can run 1 chart. If the EA doesn't work, you will see a message on your journal log with a memory exception. I took 1GB to be large, in reality it is a little less.

2. Hello, If I use 4 sun pairs, Do I use low risk or custom set? and do i have change the magic number?

- Hi, it's up to you and it depends if you are using them on the same account or not. You can check at my set for my 4 pairs signal here in the description:!tab=description. You don't need to change the magic if it's on a different pair but it's a good practice to do it :)

3.  Hello Arthur, what different is between your EA Sun for the different pairs? Is there one EA for all pairs available? 

Hello, each Sun EA has the same "engine" but uses different strategies based on what has worked the best for each pair.  There isn't an EA with all pairs.

4.   Sun is a long term project? Will you keep optimizing it in the future?

 Yes Sun is a long term project, i'll keep update it.

5.   Hello! Is having multiple Sun ea running with the same account is more profitable than only one? Example using Eurusd with Usdchf or Eurusd with Usdjpy)

-  Hi! It is the same. It just depends of the settings you applied to each one

6.   Hi Arthur, couple of questions, less number of cycle will equate less risk correct? because less trades? but why your high risk set files has less number of cycles?

-  Hi. Not really, if you adapt the auto lot and the cycle per balance, it is less risky because if you have only 1 cycle, if it SL you are stuck and you lose all the potential. if you divide it into 10 cycles, maybe 1 or 2 will SL but probably not the 10, and once the first cycle is open, other can still trade and you are are not stuck with one cycle. That means more trades and less SL. 

7.   I noticed that you had backtest from 2017. why when i tried backtest 2016 with 100% quality, the results is so bad? would u mind give some explanation~ thank you

-  Hi, it is because it is not optimized on this period. Sun focus on the last 5 years to find its patterns.

8.    Any plans to reduce the EA price of SUN?

-  Hi, No special offers are planned at this time. If the purchase price is too high for your account, the rental price will allow you to invest less and be able to reinvest the profits on the next month.

9.    Could you please tell me what is the "SL built into the cycle" of Sun EA (bool "Use cycle stoploss")? Is it the DD SL and/or Equity SL which can be set, or it is an EA internal integrated SL calculation based on your algo? How much would I expect if set to true and the SL is triggered?

-  Hi, "Use cycle stoploss" is a setting that closes the cycle if it crosses a specific value. It is an internal EA SL, it is different for each pattern used based on what worked on the past data. I'd say very approximatively the SL is around 100$ per cycle per SL but it can be more or less. DD SL, Equity SL and Equity TP are others security that are only based on your equity and balance.

10.  If there are already 10 active cycles of trades at the moment, will it cause issues to EA if I change setting to 5 cycles?

-  Hi, no, the 10 cycles will remain open but no new cycle will open until you went back to less than 5.

11.   I have a question for the SL in the Cycle. When close the SL a cycle? I feel safer, when i know, that a cycle close itself before crashing my account?

-  Hi,  I'll use an example to answer your question. Let's say a cycle has a number of 5 max orders and a distance of ~250 pts between orders, if the cycle goes the 250 pts distance from the fifth order by the end of the M1 candle, the cycle will close all orders.  If you are worried about your account being blown, you can also set the equity SL to secure a minimum equity on your account

12.  I have been able to try an old version of your EA with much worse results than in a new version and that makes me suspicious, why is this?

- Hi! Patterns are regularly updated. When a pattern hit a SL it will be replace in the next update. The concept is to find patterns that worked in the past to achieve a high success rate. But patterns will fail one day, alwaysSo old patterns are replaced with new ones, and hopefully, we have a positive win rate in the future. PS: If I could predict a 100% winrate EA on a live account, i would be billionaire, and I would not sell it on mql5. 

13.  I don't have any order on the strategy tester or in live account, is it normal?

- Hi! if you don't have orders on the strategy tester, try to change the value "Order filling type" from auto to the other ones. 

10. Pricing

The price of Sun is justified by the cost of the pattern research (hardware + electricity) as well as the time spent for the research (several weeks per pair).
It also includes the cost of keeping the patterns up to date when they become less efficient over time. 
The price does not guarantee future performance.

11. Conclusion

Sun's algorithm is the result of years of work. Each new pair added represents several weeks of computing time.

If you like this kind of product, don't hesitate to leave a review.

If you have a question, feel free to send me a private message on MQL5 or join my discord

Have a good day, 



Trading in foreign exchange (“Forex”) on margins entails high risk and is not suitable for all investors. Past performance is not an indication of future results. In this case, as well, the high degree of leverage can act both against you and for you. Before you decide to invest in foreign exchange, you should carefully assess your investment objectives, experience, financial possibilities and willingness to take risks. There is a possibility that you will lose your initial investment partially or completely. Therefore, you should not invest any funds that you cannot afford to completely lose in a worst-case scenario. You should also be aware of all the risks associated with foreign exchange trading and contact an independent financial advisor in case of doubt.

Leverage enables traders, using a relatively small amount of money, to take a position that is many times the initial investment. This leverage effect can work both in your favour and to your detriment. The Forex market opens up the possibility to utilize this leverage effect to a high degree; at the same time, however, it also opens up the risk of experiencing high losses. Please trade with caution when you use leverage in trading or investing. Your risk is particularly not limited to the initial investment, but can quickly fall into a negative range in the event of strong movements, meaning you may be obligated to pay far more than your initial wager.

Share it with friends: