fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Brokers with fixed spread and Spread filter

    Questions & Answers
    2
    10
    2634
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      SF9CN2kR last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        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

        1 Reply Last reply Reply Quote 0
        • S
          SF9CN2kR last edited by

          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 🙂

          1 Reply Last reply Reply Quote 0
          • fxDreema
            fxDreema last edited by

            Spread is Ask - Bid. Also available somewhere in Condition - Market properties. In MQL4 you can also use the predefined variables Ask and Bid

            1 Reply Last reply Reply Quote 0
            • S
              SF9CN2kR last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • fxDreema
                fxDreema last edited by

                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?

                1 Reply Last reply Reply Quote 0
                • S
                  SF9CN2kR last edited by

                  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?

                  1 Reply Last reply Reply Quote 0
                  • fxDreema
                    fxDreema last edited by

                    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&#58;");
                          }
                          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&#58;");
                          }
                          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&#58;");
                          }
                          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));
                    }
                    
                    1 Reply Last reply Reply Quote 0
                    • S
                      SF9CN2kR last edited by

                      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! 😄

                      1 Reply Last reply Reply Quote 0
                      • fxDreema
                        fxDreema last edited by

                        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).

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post

                        Online Users

                        J
                        T
                        J
                        B

                        13
                        Online

                        146.7k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors