Trendy MA Crossover USDJPY
- Experts
- Dipak Dilip Reddy
- Version: 3.4
- Activations: 5
The code is a trading robot that uses two indicators moving averages crossover and envelopes. It opens a buy or sell trade when the fast moving average crosses the slow moving average and the price is above or below the envelopes. It closes the trade when the opposite signal occurs or when the stop loss or take profit is reached. It also has some session settings to limit the trading hours and days. The code has some input parameters to adjust the trade size, stop loss, take profit, magic number, and indicator settings. The code has four main functions OnInit(), OnTick(), OnDeinit(), and OnBar(). The OnInit() function initializes the indicators and validates the input parameters. The OnTick() function calls the OnBar() function when a new bar is formed. The OnDeinit() function deletes the indicators from the chart. The OnBar() function updates the position information and checks if it needs to close or open a trade based on the indicator signals and session settings. It also manages the trailing stop if enabled.
Preferred: USDJPY H1
Preferred brokers: Octafx incorporated.