Announcement

Collapse
No announcement yet.

Signal clarity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re: Reply to post 'Signal clarity'

    Well, kind of.

    Do you see where we check to see if all three of the signals add up to 3?

    You can change the sum (a1+a2+a3+a4) to add up to 2, 4 or even 1, depending
    on which signals you want to use to trigger entry and exit signals

    >

    Comment


    • Cool, can do. Was looking at the macd and maybe we should change it to a bar by bar analysis instead of the 0 marker cross. It is lagging to much. Your refering to line 97 and 100 right?


      Fibbgann
      Excellent book on JavaScript for beginners

      Comment


      • Re: Reply to post 'Signal clarity'

        Yes lines 97 and 100 and the couple of lines above that for the back test.

        I can clean this up so it is easier to adjust, let me post a new FGallFalse
        in a sec.
        >

        Comment


        • Re: Reply to post 'Signal clarity'

          What do you mean, bar by bar analysis?

          >

          Comment


          • UH OH are we using Fgall for the chart and FGallFalse for the backtest? I think all these efs's are messing em up.

            If you don't mind maybe create 2 folders in the file share. One for the most updated files we are testing. Sorry, probably my bad.



            Fibbgann
            Excellent book on JavaScript for beginners

            Comment


            • Maybe I can help..

              David,

              You have to write the strategy code to encompass all potentials...

              /*
              if(dir==+1)
              profit=entry-close();
              else
              profit=close()-entry;

              if(profit<-10)exit now
              if(profit>10)take money and run
              do we re enter another long if we just went long or do we wait for the next
              short, just like the sar method used before?
              */

              what do I use? Strategy.doSell for long exit and Strategy.doCover for
              short exit

              Possible Profit Exit on a long
              Strategy.doSell("Close Long", Strategy.MARKET, Strategy.THISBAR,
              Strategy.ALL, entry+10);
              Possible Profit Exit on a short
              Strategy.doCover("Close Short", Strategy.MARKET, Strategy.THISBAR,
              Strategy.ALL, entry+10);
              In this case, you would want to test for PROFITS on every bar, then execute the exit conditions as follows.. (one other thing, you may want to include a vTICK value to allow for 1 tick above/below your exit price)..

              var vTick = 0.25;
              var PTAmount = 10.0;


              if (Strategy.isLong()) { // We are currently long
              if (high() > (entry+PTAmount)) { // high has breached our PT level.
              if (low() > (entry+PTAmount)) { // low is higher than our PT - exit at OPEN of this bar.
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,Strategy.ALL, open);
              } else { // normal exit
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,
              Strategy.ALL, (entry+PTAmount+vTick));
              }
              }
              }
              if (Strategy.isShort()) { // We are currently short
              if (low() < (entry-PTAmount)) { // low has breached our PT level.
              if (high() < (entry-PTAmount)) { // high is lower than our PT - exit at OPEN of this bar.
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,Strategy.ALL, open);
              } else { // normal exit
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,
              Strategy.ALL, (entry+PTAmount+vTick));
              }
              }
              }

              Now, as a suggestion, I might suggest a multi-stage PT system. These work to allow you to enter say 2 or 3 contracts on your entry triggers, then "stage" the exits as well as adjust your stops along the way...

              The code would look like this...

              var vTick = 0.25;
              var DefaultEntryContracts = 3;
              var DefaultExit1Contracts = 1;
              var DefaultExit2Contracts = 1;
              var DefaultExit3Contracts = 1;
              var PTAmount1 = 2.0;
              var PTAmount2 = 5.0;
              var PTAmount3 = 10.0;
              var PTStage = 0;

              if (whatever_to_go_long) {
              Strategy.doLong("Long Entry", Strategy.MARKET, Strategy.THISBAR, DefaultEntryContracts);
              PTStage = 1;
              entry = close();
              }
              if (whatever_to_go_short) {
              Strategy.doShort("Short Entry", Strategy.MARKET, Strategy.THISBAR, DefaultEntryContracts);
              PTStage = 1;
              entry = close();
              }


              // Stage #1 PTs
              if ((Strategy.isLong()) && (PTStage == 1)) { // We are currently long
              if (high() > (entry+PTAmount1+vTick )) { // high has breached our PT level.
              if (low() > (entry+PTAmount1 )) { // low is higher than our PT - exit at OPEN of this bar.
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,DefaultExit1Contracts , open);
              } else { // normal exit
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit1Contracts , (entry+PTAmount1 +vTick));
              }
              PTStage +=1;
              }
              }
              if ((Strategy.isShort()) && (PTStage == 1)) { // We are currently short
              if (low() < (entry-PTAmount1-vTick)) { // low has breached our PT level.
              if (high() < (entry-PTAmount1)) { // high is lower than our PT - exit at OPEN of this bar.
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,DefaultExit1Contracts , open);
              } else { // normal exit
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit1Contracts , (entry-PTAmount1-vTick));
              }
              PTStage +=1;
              }
              }

              // Stage #2 PTs
              if ((Strategy.isLong()) && (PTStage == 2)) { // We are currently long
              if (high() > (entry+PTAmount2+vTick)) { // high has breached our PT level.
              if (low() > (entry+PTAmount2 )) { // low is higher than our PT - exit at OPEN of this bar.
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,DefaultExit2Contracts , open);
              } else { // normal exit
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit2Contracts , (entry+PTAmount2+vTick));
              }
              PTStage +=1;
              }
              }
              if ((Strategy.isShort()) && (PTStage == 2)) { // We are currently short
              if (low() < (entry-PTAmount2-vTick)) { // low has breached our PT level.
              if (high() < (entry-PTAmount2)) { // high is lower than our PT - exit at OPEN of this bar.
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,DefaultExit2Contracts , open);
              } else { // normal exit
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit2Contracts , (entry-PTAmount2-vTick));
              }
              PTStage +=1;
              }
              }

              // Stage #3 PTs
              if ((Strategy.isLong()) && (PTStage == 3)) { // We are currently long
              if (high() > (entry+PTAmount3+vTick )) { // high has breached our PT level.
              if (low() > (entry+PTAmount3 )) { // low is higher than our PT - exit at OPEN of this bar.
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,DefaultExit3Contracts , open);
              } else { // normal exit
              Strategy.doSell("Close Long", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit3Contracts , (entry+PTAmount3 +vTick));
              }
              PTStage +=1;
              }
              }
              if ((Strategy.isShort()) && (PTStage == 3)) { // We are currently short
              if (low() < (entry-PTAmount3-vTick)) { // low has breached our PT level.
              if (high() < (entry-PTAmount3)) { // high is lower than our PT - exit at OPEN of this bar.
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,DefaultExit3Contracts , open);
              } else { // normal exit
              Strategy.doCover("Close Short", Strategy.LIMIT, trategy.THISBAR,
              DefaultExit3Contracts , (entry-PTAmount3-vTick));
              }
              PTStage +=1;
              }
              }

              This will allow the system to exit on the selected PTs. You could also add stop adjustments into this if necessary. Any reversal (entry) signal will completely reverse the trading system and restart the PTstages.

              Hope this helps...
              Brad Matheny
              eSignal Solution Provider since 2000

              Comment


              • Re: Reply to post 'Signal clarity'

                Most recent files are all posted

                >

                Comment


                • By the time the MACD crosses the 0 point all the other indicators have already given there sell signals. (vise versa). So I was thinking maybe we should look at it in this sense. If current bar (close) is lower than previous (sell signal. and the opposite for longs. If you look at some charts you will see what I am refering too.

                  Fibbgann
                  Last edited by FibbGann; 12-14-2003, 07:03 PM.
                  Excellent book on JavaScript for beginners

                  Comment


                  • Re: Reply to post 'Signal clarity'

                    Brad

                    I think I understand but here is what I had in mind

                    if(dir==+1)
                    profit=entry-close();
                    else
                    profit=close()-entry;

                    if(profit<-maxLoss&&Strategy.isLong()==true)
                    Strategy.doSell("Close Long", Strategy.MARKET,
                    Strategy.THISBAR,Strategy.ALL, entry-maxLoss);
                    if(profit>+maxGain&&Strategy.isLong()==true)
                    Strategy.doSell("Close Long", Strategy.MARKET,
                    Strategy.THISBAR,Strategy.ALL, entry+maxGain);
                    if(profit<-maxLoss&&Strategy.isShort()==true)
                    Strategy.doSell("Close Long", Strategy.MARKET,
                    Strategy.THISBAR,Strategy.ALL, entry-maxLoss);
                    if(profit>+maxGain&&Strategy.isShort()==true)
                    Strategy.doSell("Close Long", Strategy.MARKET,
                    Strategy.THISBAR,Strategy.ALL, entry+maxGain);

                    or this too simple?

                    >

                    Comment


                    • Re: Reply to post 'Signal clarity'

                      Some times I have used the MACD change in direction as a signal, in other
                      words if the histogram begins moving up, that is the long signal - even if
                      the histogram hasn't reached zero yet.

                      Let me know what you think and I add it to the code as best I can.


                      >

                      Comment


                      • Don't use the cross of the zero line by the Histogram. That is way too slow. Use the MACD crossing the signal. You will get better results.

                        Comment


                        • Thats fine. I see what your refering too. I was just lookiing into the coding. I say leave it. but, will personally drop it from my personal testing. I read candles just as easy as looking at a MACD.


                          Fibbgann
                          Excellent book on JavaScript for beginners

                          Comment


                          • Re: Reply to post 'Signal clarity'

                            Gavishti

                            Don't use the cross of the zero line by the Histogram. That is way too slow.
                            Use the MACD crossing the signal. You will get better results.

                            Am I mistaken but the histogram of the MACD is just the relationship of the
                            lines crossing, isn't it?

                            >

                            Comment


                            • Sorry my bad the coding is refering to as an x-over.
                              Just a note i don't think tommorow is going to be a good testing day because of the news.


                              Fibbgann
                              Excellent book on JavaScript for beginners

                              Comment


                              • David

                                Am I mistaken but the histogram of the MACD is just the relationship of the lines crossing, isn't it?

                                That is correct.
                                Alex

                                Comment

                                Working...
                                X