Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 130
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
Hi all! Please advise me on this subject... I want to shift MA level in levels tab. If I want to shift it to 798, it is too complicated to calculate for many pairs. How to write an indicator that either draws the price of shifted moving average or displays it in the data window and I don't have to calculate it manually?
Such a problem - there is a one-dimensional array whose size can vary.
How to loop through all possible combinations of array elements with each other?
The order of elements doesn't matter, i.e. 123==213==321...
Here is an example for an array with 4 elements:
It is a good task for your brain. You can try this:
Test result for dimension 4. If X element of the array is not selected, otherwise use array[digit] and fragment for dimension 6:
Make an indicator whose input data will specify the MA shift. And the indicator will calculate the price level and immediately display its objects on the chart.
I do not know how to do it and, frankly speaking, I have no idea how - when I open the МА МА code, there is so much stuff there that I do not see where the level parameter is, so I cannot copy and paste levels.
I don't know how to do it and, to be honest, I have no idea how to do it - I open the MA code, there is so much stuff there that I don't see where the level parameter is, so I can copy and paste levels in it. What part of the MA code should I copy and where should I paste levels?
No, you need to start writing your own indicator, and then they will tell you what you need to do.
I have created a new indicator, so far it looks like this:
#property copyright "Copyright 2013, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialisation function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
#include "Moving Averages.mq4"
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Creating custom indicators
There are levels in the MA indicator. The question is this - how can we get data from these levels, say the price has reached level 100 or -100 (open a buy/sell trade).
The MA itself on the zero (current) bar is:
To calculate the MA, we take the Open price to get rid of the "chatter" on the current bar.
Then the price of level +100 will be:
The level price of -100 will be:
The MA itself on the zero (current) bar is:
To calculate the MA, we take the Open price to get rid of the "chatter" on the current bar.
Then the price of level +100 will be:
The level price of -100 would be:
Thank you, you've helped me out more than once. I'm sure I'll get to grips with the programming soon.....
A good task for the brain. You can try it like this:
Test result for dimension 4. If X element of array is not selected, otherwise use array[digit] and fragment for dimension 6:
I looked at your code, but I don't understand the following - you didn't read the data of the original array at any of the steps. only the number of elements in it