fly7680: I need to set all the arrows that come out in the graph permanently. With this code, if it goes off the internet connection, they disappear from the graph and do not want to happen. How can I fix the arrows permanently?
- Your code is broken, fix it. Or post the rest.
- Do your lookbacks correctly.
- Are your books one column but two feet wide? No because that is unreadable. They are 6 inches, sometimes two columns, so you can read it easily. So should be your code. I'm not going to go scrolling (or moving my eyes) back and forth trying to read it. Edit the post with formatted code and you might get additional help.
I apologize you're right, this is the full code.
I would like to know how to fix the arrows on the chart.
If your Internet connection goes away or the MT4 is disconette, the arrows on the graph disappear.
I would like to know how to fix the arrows on the chart.
If your Internet connection goes away or the MT4 is disconette, the arrows on the graph disappear.
I ask again apologize for not being more specific in early post
thank you
#property indicator_chart_window #property indicator_buffers 2 #property indicator_type1 DRAW_ARROW #property indicator_width1 2 #property indicator_color1 Blue #property indicator_label1 "Sell" #property indicator_type2 DRAW_ARROW #property indicator_width2 2 #property indicator_color2 Lime #property indicator_label2 "Buy" double Buffer1[]; double Buffer2[]; double myPoint; //initialized in OnInit void myAlert(string type, string message) { if(type == "print") Print(message); else if(type == "error") { Print(type+" | FractalMedia @ "+Symbol()+","+Period()+" | "+message); } else if(type == "order") { } else if(type == "modify") { } } int OnInit() { IndicatorBuffers(2); SetIndexBuffer(0, Buffer1); SetIndexEmptyValue(0, 0); SetIndexArrow(0, 242); SetIndexBuffer(1, Buffer2); SetIndexEmptyValue(1, 0); SetIndexArrow(1, 241); //initialize myPoint myPoint = Point(); if(Digits() == 5 || Digits() == 3) { myPoint *= 10; } return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { int limit = rates_total - prev_calculated; //--- counting from 0 to rates_total ArraySetAsSeries(Buffer1, true); ArraySetAsSeries(Buffer2, true); //--- initial zero if(prev_calculated < 1) { ArrayInitialize(Buffer1, 0); ArrayInitialize(Buffer2, 0); } else limit++; //Indicator Buffer 1 if(iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 2+0) > iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 2+0) && iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 1+0) < iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 1, 1+0) ) { Buffer1[0] = High[0] + 1 * myPoint; } //Indicator Buffer 2 if(iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 2+0) < iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 0, 2+0) && iMA(NULL, PERIOD_CURRENT, 4, 0, MODE_EMA, PRICE_CLOSE, 1+0) > iCustom(NULL, PERIOD_CURRENT, "FractalChannel", 0, 1+0) ) { Buffer2[0] = Low[0] - 1 * myPoint; } return(rates_total); }
if(prev_calculated < 1) { ArrayInitialize(Buffer1, 0);
Had you read the documentation, you would know that buffers are automatically initializedelse limit++;
Where is your loop using limit?- Already answered: "do your lookbacks correctly."
The for loop I deleted it because the historian was not true and when the internet goes away sposatavano the arrows on the chart. I read but I did not understand lookbacks correctly.
Sorry
Code delede:
else limit++; //--- main loop for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation
WHRoeder:
- Had you read the documentation, you would know that buffers are automatically initialized
Where ?
Buffers are initialized when you use SetIndexBuffer, they are NOT re-initialized when the number of bars increase (prev_calculated=0 after the first call).
You are right guys, but unfortunately I understand little English and I did not understand the buffers
Should I set the buffer differently?
Thanks again and sorry for my lack of preparation
Should I set the buffer differently?
Thanks again and sorry for my lack of preparation
angevoyageur: Where ?
Buffers are initialized when you use SetIndexBuffer, they are NOT re-initialized when the number of bars increase (prev_calculated=0 after the first call).
I forgot it changed in 600. That use to be the case:Buffers are initialized when you use SetIndexBuffer, they are NOT re-initialized when the number of bars increase (prev_calculated=0 after the first call).
int ArrayInitialize( | void array[], double value) |
Note: It is not recommended to initialize index buffers in the custom indicator init() function as such functions are initialized automatically with an "empty value" at allocation and re-allocation of buffers.
Parameters:
array[] | - | Numeric array to be initialized. |
value | - | New value to be set. |
Sample:
//---- initializing of all array elements with 2.1 double myarray[10]; ArrayInitialize(myarray,2.1);
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
Thank you all