
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Problem # 1: Determine to what depth you need to scan the market.
By depth im hoping you mean lookback period, i usually have 150-200 bars on my screen, so i would like for it to be 200
By depth im hoping you mean lookback period, i usually have 150-200 bars on my screen, so i would like for it to be 200
Yes, you got it right. Next, you need to enter the settings for "similar candles" - this is a percentage spread or a spread in points. The parameter "group of candles" is also needed - a group of neighboring candles among which there is a search ...
Yes, you got it right. Next, you need to enter the settings for "similar candles" - this is a percentage spread or a spread in points. The parameter "group of candles" is also needed - a group of neighboring candles among which there is a search ...
I did not get this part
I searched for similar candles in the Similar Candle indicator - you can take it as a basis.
Im sorry, but i still don't understand what i should be doing
Close a position if Swap was accrued
Function: 'CloseAllPositionsFirstSwap'
It is recommended to call this function at the beginning of the day.
The EA can open only one position of the same type
Code: Example One position of one type.mq5
How the Expert Advisor works: the 'CalculateAllPositions' function is called in 'OnTick'. The 'CalculateAllPositions' function calculates 'BUY' and 'SELL' positions.
The number of pending orders (only system functions, no OOP)
'CalculateAllPendingOrdersSystem' function
There are two pending orders with Magic '200' and one with Magic '100' in the market - only three pending orders (all three pending orders for the 'EURAUD' symbol).
Run the script:
We get the result:
How to create an indicator - the difference between two iMAs (Moving Average)
Forum on trading, automated trading systems and testing trading strategies
Cannot initialize buffers
Vladimir Karputov, 2021.08.27 05:32
How to create an indicator - the difference between two iMAs (Moving Average).
Step 1. Right click on the folder and select 'New File'
Step 2. Indicator name (string 'Namde'), one input parameter ('Parameters')
Step 3. Selecting the full version of OnCalculate
Step 4. 'Indicator in separate windows'c, add one line' Diff_Two_iMA '
We get the workpiece:
Now we start thinking: we need to add two arrays - for two iMAs. So we change the counter and add these two arrays, and we will declare two variables - they will store two handles
Add variable 'm_init_error' - this is a flag. If there is an error while creating the indicator, this flag will be set to 'true'.
Adding input parameters for the 'Fast' and 'Slow' indicator
Go to 'OnInit': link two arrays and create two handles
Go to OnCalculate - Here are mainly copy-paste operations (using the iMA help)
Continued later ...
Forum on trading, automated trading systems and testing trading strategies
Cannot initialize buffers
Vladimir Karputov, 2021.08.27 12:24
Continuation ...
Apply copy-paste and do some manual work. From the help ( iMA ) we copy almost the entire function and change it a little for ourselves (change the name of the indicator buffers, change the name of the handle and throw out 'Comment') Here just carefully compare the help ( iMA ) and my code. First of all, add the variable 'bars_calculated' to the program header:
I have highlighted the main thing - this is the calculation of the difference
Result: