[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code Help2



PureBytes Links

Trading Reference Links

Harrison;
thanks so much
code problem solved
Dr Greg Hunt

Harrison wrote:

> Dr. Hunt,
>
> There is something in the code structure that is not doing what you
> intend it to do.  The SetProfitTarget is not the cause of the problem.
> I am sending you the ELA code that works in a separate email.
>
> -- Harrison
>
> Greg Hunt wrote:
>
> >Hi list members,
> >I am running this system on the emini Russell, 1 minute bars.
> >Buy and sell signals should alternate.
> >But they seem to be bothered by the profit target.
> >The profit target signal's description says it is from T4.
> >(Of course I'm using this on TS2ki and wonder if somehow this might be
> >causing the problem.)
> >Code is below; and a picture of the chart showing the problem is
> >attached.
> >
> >1. After the second entry, an Se, there should be an Le 2 bars later to
> >reverse that trade.
> >2. Likewise 3 bars later, there should be an Se to reverse that trade.
> >Could someone please help me with this?
> >(There are other problems but maybe later.)
> >TIA
> >Dr. Greg Hunt
> >
> > *******************************************************************************************
> >
> >INPUTS:  VARA(10), VARB(5);
> >
> > IF T > 0929 and t <= 1100  then Begin;
> >      If MarketPosition <>1 and MarketPosition(1) <>1 then BEGIN;
> >      IF TradesToday(date) < VARB THEN
> >     Buy ("Le")next bar at H + VARA points stop;
> > END;
> >
> >  IF T > 0929 and t <= 1100  then Begin;
> >     IF MarketPosition <>-1 and MarketPosition(1) <>-1 then BEGIN;
> >     Sell ("Se") next bar at L - VARA points stop;
> > END;
> >
> >  IF  TradesToday(date) >= VARB THEN BEGIN
> >   EXITLONG ("lx") next bar at Low - VARA points stop;
> >   EXITSHORT ("sx") next bar at High + VARA points stop;
> >END;
> >
> >END;
> >END;
> >{*******************************************************************
> >Description : Profit Target (Built In Profit Target Stop) - from TS 4.0
> >Provided By : Omega Research, Inc. (c) Copyright 1999
> >********************************************************************}
> >
> >Inputs: PositionBasis(True), Amount(50);
> >
> >If PositionBasis Then
> > SetStopPosition
> >Else
> > SetStopContract;
> >
> >SetProfitTarget(Amount);
> >
> >