fxDreema

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

    Create custom block?

    Questions & Answers
    2
    14
    4373
    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
      blanko last edited by

      I read some about custom block in foum, but how create one function return true o false and recieve constant params?

      bool RSISellCheck(int Loc)
      {
      double RSIMain = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,Loc);
      if(RSIMain < 50) return(false);
      for(int x=Loc;x<=Loc+2;x++)
      {
      if(High[x]>High[Loc])return(false);
      }
      for(int y=Loc+4;y<(Loc+CandlesBack);y++)
      {
      if(High[y]>High[Loc]) break;
      int s=y;
      for(int z=y-2;z<=y+2;z++)
      {
      if(High[z]>High[y]){y++; break;}
      }
      if(s!=y){y--; continue;}
      bool OB=false;
      for(int k=Loc;k<=y;k++)
      {
      double RSIOB = iRSI(Symbol(),0,RSIPeriod,PRICE_CLOSE,k);
      if(RSIOB>70) {OB=true; break;}
      }
      if(OB==false) continue;
      double Mom1=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,Loc);
      double Mom2=iMomentum(Symbol(),0,MomentumPeriod,PRICE_CLOSE,y);
      if(Mom1>Mom2) continue;
      LastKDS=y;
      return(true);
      }
      return(false);
      }

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

        here is more than one way how to do this ... you can add this function here into functions:
        https://fxdreema.com/studio
        than call this function one time with custom code block:
        0_1491409022103_upload-3414e710-fcfd-4ba5-9d99-03f900cc69a4
        and now you can working with this function .. but I see here some variables which must be defined before this function or in Constants or Variables ... like: "CandlesBack" ...

        second way can be little complicated and need again custom code:
        0_1491410467950_upload-307c5a16-c871-423b-ba63-3c232654a7fd

        here are also variables and constants as inputs:
        0_1491410530498_upload-ca773880-efbf-40e5-b172-2bcef523159e
        0_1491410535621_upload-813ba68f-39c1-4c10-80fc-e27978b76070
        https://fxdreema.com/shared/9mz6YkCoe

        maybe exist something easier, but I was using it as examples above are described ...

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

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

          Thank miro1360 for your work. You read, understand my function and modificate, Your example is perfect for me. You make very work for this response. Excuxe my English, but I am very grateful.

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

            What did I do wrong?
            No open trades.
            https://fxdreema.com/shared/fii7scMJd

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

              ... my answer with return in this function was not right 😄
              try this modification:

              https://fxdreema.com/shared/Omfgtqdqd

              0_1491486464595_upload-7a095988-833f-476b-95b5-ade22b80608e

              next ... blocks Check profit unrealized - when you set filters for "both" buy and sells, it counts profit from buy and sell together ... when you will separate it, set here filter only for buy (or only for sell) ... because when you open it in hedge (buy+sell) your profit is 0-spread and it will not be closed ...

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

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

                Thank, I make the corrections. For now I disabled helding. I have new dude.
                https://fxdreema.com/shared/C7ORRhFXc

                I pretend open second trader the same type a first trade, if prive go loss profit the X pip, in this case 70pip.

                Example:
                level 1: open trade eurusd, 5m, price: 1.06700, type: buy with lot: 0.01
                when price is 1.06000 level 2 activate and open other type buy order with lot 0.03
                when profit the trade level 1 and trade level 2 it positive, more or less 1.06500 close level 1 trade in loss , and level 2 trade in profit.

                but pip away from open price block, I think do diference, it active when price up, no when price down in this example, how I repair this code?

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

                  with pink block use Dark pink block before ... because it select trade and than you can work with selected trade ...
                  0_1491499691380_upload-d54d7147-6b5c-4801-a3ab-bd537192d29b

                  ... and for opposite direction (trade in loss) give Pips_To_Trade_Second as negative value ...

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

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

                    thank you, I make correction now, It very easy, but I don´t know negative numbers.

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

                      I mean as input try it while testing ...
                      Pips_To_Trade_Second = 20 --- is possitive
                      Pips_To_Trade_Second = -20 --- is negative (opposite direction)

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

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

                        New version
                        https://fxdreema.com/shared/4gOK5oQE
                        on Trade tab, block 181. I try create message for coment block id 38, in update stats block I try update varible+1, when close each type trades. The values always 0, what does i wrong?

                        Level 3 I try open oposite trades a open trade level 1 and open trade level 2, very soon i show finish.

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

                          In comment block, I put trade close, don´t work, it is posible, I haven´t same pre block, for use this information?

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

                            I have not good understood your question ....

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

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

                              I explain other form, excuse my bad english.

                              In block 177, I try update variables, but no update, What did I do wrong? Variables always 0, I show variable with comment block
                              https://fxdreema.com/shared/LPgRRDA5b

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

                                send here please example with lower amount of blocks where it is not working (which shows your issue) because when is here a lot of blocks, I have not enough time to study all where can be problem 😄

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

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

                                Online Users

                                J
                                B
                                M
                                B
                                T

                                19
                                Online

                                146.7k
                                Users

                                22.4k
                                Topics

                                122.6k
                                Posts

                                Powered by NodeBB Forums | Contributors