Announcement

Collapse
No announcement yet.

Ussing a ma crossover in a strategy

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

  • Ussing a ma crossover in a strategy

    I have found that every one of the stategies that come with esignal and regard ma crossovers all have the same fault. Thet all buy or sell the open of the current bar instead of the next bar.
    Since i am relatively new here i was wondering is this problem has been noticed in the past and addressed. The problem is easily fixed by changing THISBAR to NEXTBAR.

    Also if i want to place two different emas in one study when i call them do i use study1 for second one
    e.g
    var study= new MAStudy(10,0,Close, MAStudy.EXPONENTIAL);
    var study1 = new MAStudy(20,0, Close, MAStudy.EXPONENTIAL);

    now is it possible for a strategy to buy or sell right at the level of the 10ema during the bar which it hits the ema as opposed to entering on the open of the next bar.
    The basic idea here is to sell when the bar hits the 10ema as long as the 10ema<20ema when the 10ema is it.
    ive got a good handle on how to program stops and profit objectives it just entries that keep giving me difficulties
    Thanks again everyone for all your help
    Yoda

  • #2
    yoda
    yesterday I posted an example efs that buys/sells at the high/low plus or minus a stop in this thread.
    The file is called test3.efs.
    There is something that is not quite right with how the bars get painted but the entries are at the correct prices.
    Alex
    Last edited by ACM; 03-05-2003, 06:56 AM.

    Comment


    • #3
      Thanks alexis,
      Ill try it. Been busy all mornig trying to code a strategy that buys a crossover of the 10ema if the 10ema>20ema.
      It does everyting i want except for the fact it will take multiple trades in a row so i guess i need a conditon that the previous bars close is <10ema.

      Comment


      • #4
        yoda
        Try the attached
        It should buy/sell at the breakout (plus or minus 0.25) of the bar where the MAs crossover.
        Alex
        Attached Files

        Comment


        • #5
          It can be done also without setting the crossover condition as in the attached.
          Alex
          Attached Files
          Last edited by ACM; 03-05-2003, 07:12 AM.

          Comment


          • #6
            thanks
            ill try it. my next step is to combine the slope.efs stregy with the ma crossover so that i only take longs if the slope>slopup and the 10ema>20ema and the previous bars close is <10ema.
            Im almost there just got to work out why my code wont post any data when i try to combine them.
            Would it be possible for me to pm you the code to look at
            Yoda

            Comment


            • #7
              why in your slope.efs do you have setpricestudy(false); but in youe maxover.efs you have setpricestudy(true);
              If i would combine both inot one efs which should i use?
              Is it beacuse the maxover.efs overlays the price bars where the slope.efs study is displayed below the price bars?
              Thanks
              yoda

              Comment


              • #8
                Re: Reply to post 'Ussing a ma crossover in a strategy'

                yoda
                Yes, the slope.efs was initially coded by David Loomis who was plotting the
                slope as an oscillator (hence the false statement). I just modified it by
                adding the input variables and changing the conditions to paint the bars.
                In the case of maxover I am plotting averages on the price study which needs
                the true statement.
                I don't see why you couldn't use the true statement and just x-out the part
                in the slope efs that plots the oscillator.
                Alex

                Comment


                • #9
                  It seems like using the wizard saves you alot of steps. Do you know what wizard command i would use to use a hard stop and a hard profit objective since right now it acts like an sar system thereby missing several trades.
                  It does look like however that your code only takes one trade at a time.
                  Ive think ive figured out how to use the javascript code to accomplish any kind of entry and stop but im cluelss when it comes to implemnting the wizard.
                  My ultimate goal here is to have 4 conditions to go long
                  1)10ema slope>.02
                  2)10ema>20ema
                  3)close >10ema
                  4)close(-1)<10ema
                  and the following 4 conditons to go short
                  1)10ema slope<-.02
                  2)10ema<20ema
                  3)close() <10ema
                  4)close(-1)>10ema
                  Using a profit objective of 1 point and a stop of 1 point which of course will be adjusted dependent on the time frame involved.
                  so far i am only able to get conditons 2,3,4 to work together.When i try to add in code for the slope i get data errors left and right.
                  Once again thanks for you outstanding assistance.
                  Yoda

                  Comment


                  • #10
                    Re: Reply to post 'Ussing a ma crossover in a strategy'

                    yoda

                    Would it be possible for me to pm you the code to look at

                    It would be better if you post it to the forum so that also
                    other members can assist you

                    Alex

                    Comment


                    • #11
                      Re: Reply to post 'Ussing a ma crossover in a strategy'

                      It seems like using the wizard saves you alot of steps

                      Yes in some ways it does. However it is still has a number of limitations
                      but it is my understanding that Dion is working to make it as complete a tool as possible.

                      It does look like however that your code only takes one trade at
                      a time


                      That is because of the way it was set by my conditions.
                      It could be modified to take multiple trades in a given direction.

                      Alex

                      Comment

                      Working...
                      X