Brokers with fixed spread and Spread filter
-
I recently tried to use the spread filter box for an expert and my broker is using fixed spread and it's not working. I track the Min./Avg./Max. spread from the experts info when I drop it on a chart and some times in the day it shows spread changes with fixed spread. How it does and can I make Min./Avg./Max. spread work with an expert? What other option may I have?
-
You know... people are often asking me something and then when I see what they are doing it turns out that the problem is something entirely different. Show me something that I can try and see the problem
-
I can't upload in this forum and I am using an opera browser which is not compatible with the online version. It is very simple to understand. The block with the name, "Spread Filters" (I use the local version >> build 099 (23 August 2015), doesn't execute a sound which I want to. I connected after it a second alert block with the name "Play Sound" very simple. I hope you understand this time.
A diagram: Spread Filters >> Play Sound - only two blocks

-
Spread is Ask - Bid. Also available somewhere in Condition - Market properties. In MQL4 you can also use the predefined variables Ask and Bid
-
I tried with no success, should be the fixed spread of the broker, any recommendations and how the minimum, maximum and average spread is showing changes with fixed spread broker on the left of my screen info of forex dreema experts will be very helpful.
-
I don't really understand what are you trying to do. There is no min and max spread in blocks, I'm not aware of such thing. There is a spread meter on the lower left corner, but this only shows things. Can you show me what are you trying to do?
-
I just want an expert that gives alerts when spread is changing, but I see that the blocks are not using min. and max. spread. Anyway can you show me in your code where and how the min and max. spread is calculated?
-
I use the function below. Nothing really fancy, simple calculations
if (current_spread > max_spread) {max_spread = current_spread;}
if (current_spread < min_spread) {min_spread = current_spread;}max_spread and min_spread are static variables, which means that they stay in memory.
void DrawSpreadInfo() { static bool allow_draw = true; if (allow_draw==false) {return;} if (MQLInfoInteger(MQL_TESTER) && !MQLInfoInteger(MQL_VISUAL_MODE)) {allow_draw=false;} // Allowed to draw only once in testing mode static bool passed = false; static double max_spread = 0; static double min_spread = EMPTY_VALUE; static double avg_spread = 0; static double avg_add = 0; static double avg_cnt = 0; double custom_point = CustomPoint(Symbol()); double current_spread = 0; if (custom_point > 0) { current_spread = (SymbolInfoDouble(Symbol(),SYMBOL_ASK)-SymbolInfoDouble(Symbol(),SYMBOL_BID))/custom_point; } if (current_spread > max_spread) {max_spread = current_spread;} if (current_spread < min_spread) {min_spread = current_spread;} avg_cnt++; avg_add = avg_add + current_spread; avg_spread = avg_add / avg_cnt; int x=0; int y=0; string name; // create objects if (passed == false) { passed=true; name="fxd_spread_current_label"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+1); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+1); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 18); ObjectSetInteger(0, name, OBJPROP_COLOR, clrDarkOrange); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "Spread:"); } name="fxd_spread_max_label"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+148); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+17); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrOrangeRed); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "max:"); } name="fxd_spread_avg_label"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+148); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+9); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrDarkOrange); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "avg:"); } name="fxd_spread_min_label"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+148); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+1); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrGold); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "min:"); } name="fxd_spread_current"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+93); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+1); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 18); ObjectSetInteger(0, name, OBJPROP_COLOR, clrDarkOrange); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "0"); } name="fxd_spread_max"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+173); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+17); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrOrangeRed); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "0"); } name="fxd_spread_avg"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+173); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+9); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrDarkOrange); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "0"); } name="fxd_spread_min"; if (ObjectFind(0, name)==-1) { ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x+173); ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y+1); ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_ANCHOR, ANCHOR_LEFT_LOWER); ObjectSetInteger(0, name, OBJPROP_HIDDEN, true); ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 7); ObjectSetInteger(0, name, OBJPROP_COLOR, clrGold); ObjectSetString(0, name, OBJPROP_FONT, "Arial"); ObjectSetString(0, name, OBJPROP_TEXT, "0"); } } ObjectSetString(0, "fxd_spread_current", OBJPROP_TEXT, DoubleToStr(current_spread,2)); ObjectSetString(0, "fxd_spread_max", OBJPROP_TEXT, DoubleToStr(max_spread,2)); ObjectSetString(0, "fxd_spread_avg", OBJPROP_TEXT, DoubleToStr(avg_spread,2)); ObjectSetString(0, "fxd_spread_min", OBJPROP_TEXT, DoubleToStr(min_spread,2)); } -
I understand much better now (even, if I am not a coder just have studied some) how the calculation is done. Do you think that there is a way that I can create a spread alert EA just using forex dreema's drag and drop tool? I wish I was a coder!

-
EAs can do calculations and pop-up Alert box. Making calculations is not one of the advantages of EA builder like this, but it's possible of course. You can see that "Formula" block, it's pretty basic. It's not impossible, but it's also not very elegant. You can work with Variables, you can use the "Custom MQL4 code" block, you can even create your own block (there is no documentation about this).