fxDreema

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

    Smoothed Moving Average

    Questions & Answers
    2
    17
    3420
    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.
    • B
      BlueMoon last edited by

      I use the following block in my code to make trading decisions. Basically if this passes then "Buy" trade and if it does not then "Sell" trade. Seems like this did not work properly. I can clearly see on my chart that the 5 MA is indeed above 8 MA, it still took a "Sell" trade instead of "Buy"
      I will have to say that the EMAs are close but still I confirmed 5MA is > 8MA.

      Is this possible? What could be happening here?

      0_1493383765954_upload-badf2730-3b4d-41bb-b380-1f712cdda1c0

      1 Reply Last reply Reply Quote 0
      • M
        miro1360 last edited by

        More settings - set Candle ID to 1
        because when it is 0, you are working with not closed candle and it "repaints"

        Between trading and gambling is a very small gap, be careful.

        B 2 Replies Last reply Reply Quote 0
        • B
          BlueMoon @miro1360 last edited by

          @miro1360 said in Smoothed Moving Average:

          More settings - set Candle ID to 1
          because when it is 0, you are working with not closed candle and it "repaints"

          Thank you!!

          1 Reply Last reply Reply Quote 0
          • B
            BlueMoon @miro1360 last edited by

            @miro1360 I have set the candle id to 1, but I am continue to see the same problem. I can visually very cleat see the MA5 to be above MA8, but it still takes the "Sell" trade instead of the "Buy" trade?

            What could be happening here?

            1 Reply Last reply Reply Quote 0
            • M
              miro1360 last edited by

              you set it for both MA (left and right)?
              are you looking in chart for good MA mode (smoothed) and periods?

              Between trading and gambling is a very small gap, be careful.

              B 1 Reply Last reply Reply Quote 0
              • B
                BlueMoon @miro1360 last edited by

                @miro1360 said in Smoothed Moving Average:

                you set it for both MA (left and right)?
                are you looking in chart for good MA mode (smoothed) and periods?

                I did set it for both MA mode. Yes to left as well as right. See the following screenshot.
                Also see the screeshot below it. The red line is my 5MA and blue line is 8MA. If you notice Red line is clearly above the blue line right before the big bull candle. But the EA did not take the "Buy" trade after the close of previous candle. It took a "Sell" trade instead. It did take the "Buy" trade after the close of the Big Bull candle that you see. It just seems to me like it is seeing things 1 candle late.

                0_1498058851104_upload-07f31c73-0436-4c1c-b681-00ab4e2b47a7

                0_1498058771464_upload-9c047d43-fe7d-4bb5-94a0-7337c4ca687a

                1 Reply Last reply Reply Quote 0
                • M
                  miro1360 last edited by

                  this smoothed MA is only condition which is needed for buy trade?

                  Between trading and gambling is a very small gap, be careful.

                  1 Reply Last reply Reply Quote 0
                  • B
                    BlueMoon last edited by

                    There are other logics I have in blocks but I don't think that matters.

                    But since you asked I will provide all details.

                    I am running this on "On Tick" event.
                    My first block is "Once per bar"
                    This is followed by the condition which checks the Smoothed MA. If this block passes. I have another condition that check if my Trend variable is equal to "Sell" This means that until now the prices were in downtrend. After the last closed bar now the prices are going to go up (as per my logic and theories/strategies) So I close existing "sell" trades. I then open a "Buy" trade. I then also now set the Trend variable to "buy" since I am not in uptrend. I now wait for another crossover condition when the 5MA < 8MA

                    Let me know if I can provide more clarification. I don't believe any other conditions I am using matters. It just seems like it is doing what it is supposed to but 1 candle late.

                    0_1498064098441_upload-fdb39005-73e5-426e-9492-e218c13c90ec

                    1 Reply Last reply Reply Quote 0
                    • B
                      BlueMoon last edited by

                      I wanted to update what I have noticed. I find this behavior inconsistent. Sometimes it works and matches with what I see visually on the chart and sometimes it is 1 candle late.

                      I wonder what could be going on here? Any thoughts? Ideas? Much appreciated.

                      Could this have something to do with broker spread? Just a thought.

                      1 Reply Last reply Reply Quote 0
                      • M
                        miro1360 last edited by

                        try if this is working right ...
                        https://fxdreema.com/shared/ZXCuCOX1d

                        Between trading and gambling is a very small gap, be careful.

                        B 1 Reply Last reply Reply Quote 0
                        • B
                          BlueMoon @miro1360 last edited by

                          @miro1360 said in Smoothed Moving Average:

                          try if this is working right ...
                          https://fxdreema.com/shared/ZXCuCOX1d

                          I first wanted to thank you very much for taking the time and effort for helping me out.

                          I will sure try what you are suggesting. I still am very curious to ask..what is the difference in what you are suggesting as compared to what I am doing? It looks to me like it will yield the same result. I am curious to know where you think is the problem in what I am doing and why would this work like I want it to work?

                          I am sure going to try to out and update here in few hours.

                          Thanks a lot again!

                          1 Reply Last reply Reply Quote 0
                          • M
                            miro1360 last edited by

                            not sure yet if it does some different results, if it does, than we can compare 🙂

                            Between trading and gambling is a very small gap, be careful.

                            B 1 Reply Last reply Reply Quote 0
                            • B
                              BlueMoon @miro1360 last edited by

                              @miro1360 said in Smoothed Moving Average:

                              not sure yet if it does some different results, if it does, than we can compare 🙂

                              I was thinking could it be that the Smoothed MA could be dynamic rather than static?
                              What I mean is at a point in time the 5MA could be greater than 8MA...but depending on future candles...that point in times value may change. Is that possible?

                              If that is the case, it might explain the behavior I am seeing. When I look at the chart I am seeing the future of when the decision was made based on 5MA being higher or lower than 8MA. But after that decision was made by the EA, there might be sudden price movements that might show me the 5MA and 8MA lines a bit different when I look at it at my time as compared to what it maybe at the time of decision made by the EA.

                              Let me know your thoughts?

                              1 Reply Last reply Reply Quote 0
                              • M
                                miro1360 last edited by

                                what I know, standard SMMA (smoothed MA) from metatrader is static from Candle 1, that means it not repaints ...

                                Between trading and gambling is a very small gap, be careful.

                                1 Reply Last reply Reply Quote 0
                                • B
                                  BlueMoon last edited by

                                  it still does not seem to work. 😞
                                  See the screenshot below. You see the red 5MA is above 8MA right after Candle(3) but the EA did not take the "Buy" trade. The EA took the "Buy" trade after the bigger candle(2) You can also see the dotted green line that shows my buy trade.

                                  Had it taken the buy trade where its supposed to the trade would be in profit, but its in loss right now!

                                  What do you think?

                                  0_1498148818526_upload-84d2dcfb-7b3e-434e-9d36-3ecb3827e702

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    miro1360 last edited by

                                    actually it is working fine, look here for details in my drawing:
                                    0_1498153316356_upload-dbff39ce-4142-4b01-8cca-664621913b13

                                    CandleID 3 is not true with condition but CandleID 2 is true with condition and trade was opened when CandleID 2 was CandleID 1 (lool mixed explanation 😄 ) ... but it is working right ... MA cross hapened after big bullish candle closed (and you toke trades when candle closes (from ID 1) ) ... so I think, it is working fine

                                    Between trading and gambling is a very small gap, be careful.

                                    B 1 Reply Last reply Reply Quote 0
                                    • B
                                      BlueMoon @miro1360 last edited by

                                      @miro1360 said in Smoothed Moving Average:

                                      actually it is working fine, look here for details in my drawing:
                                      0_1498153316356_upload-dbff39ce-4142-4b01-8cca-664621913b13

                                      CandleID 3 is not true with condition but CandleID 2 is true with condition and trade was opened when CandleID 2 was CandleID 1 (lool mixed explanation 😄 ) ... but it is working right ... MA cross hapened after big bullish candle closed (and you toke trades when candle closes (from ID 1) ) ... so I think, it is working fine

                                      You are awesome Miro1360!!!! I am not happy that my strategy is not going to be profitable! but I am very joyful that we cracked the problem out. Thank you very much for the diagram and the explanation. This is 100% clear to me and I am in agreement with you about this.

                                      What I learned here is that you do not have to look at the space between the 2 candles to find out if the EMA is above or below each other. But you have to look at the center of the candle itself! Thanks again for the explanation. I am your fan now!!

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

                                      Online Users

                                      L
                                      A
                                      G
                                      N
                                      S
                                      E
                                      S
                                      N
                                      O

                                      21
                                      Online

                                      146.7k
                                      Users

                                      22.4k
                                      Topics

                                      122.6k
                                      Posts

                                      Powered by NodeBB Forums | Contributors