[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 83
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Can you tell me how should the code look like with the following conditions: if the colour of the indicator changes from red to blue, put a pending order buystop, if on the contrary, the colour of the indicator changed from blue to red, then sellstop?
Is it acceptable to use complex compound conditions
Very permissible
If we set a pending order every time we change colours, will we have too many pending orders?
The indicator is a trend indicator, it does not change colour every bar. I am interested in the condition of checking the colour change of bars and set a pending order based on it. For example, if a new bar is opened and the previous one is blue and the previous one was red, it means that the colours have changed and we should place a pending order.
I have one indicator in which all 8 indicator arrays are occupied. How to create the second one correctly, so that it draws the curve from the first indicator in 1 indicator array?
Both indicators #property indicator_chart_window.
The most obvious explanation is the analogue in the form of the code of the two linked indicators.
Thank you in advance!
This works.This is not working.
//+------------------------------------------------------------------+ //| __proba_ORSE.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 LightSeaGreen //---- buffers double MovingBuffer[]; //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MovingBuffer); return(0); } //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); //---- int limit=Bars-counted_bars; if(counted_bars>0) limit++; for(i=0; i<limit; i++) MovingBuffer[i]=iCustom(NULL,0,"___ORSE", 0, i); return(0); }
The terminal hangs. Why, I don't understand.
The indicator is a trend indicator, it does not change colour every bar. I am interested in the condition itself to check if the colour of the bars is changing and to set a pending order based on that.
TimeCurrent() % 86400
????