Register Login
Forums    February 9, 2012
TradersStudio Forums
ExitLong gives strange results
Last Post 09-13-2008 05:40 PM by David Hubbard. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Gauti Reynisson
New Member
New Member
Posts:1

--
08-19-2008 07:37 AM

    Hi I am using a moving average system that goes long when short mov. avg. crosses the longer mov. avg.

    Sub AGR_MOVINGAVECROSS01(SLen As Integer, LLen As Integer)
        Dim ShortAve As BarArray
        Dim LongAve As BarArray
       
        ShortAve = Average(Close, SLen,0)
        LongAve = Average(Close, LLen,0)
         If CrossesOver(ShortAve,LongAve)  Then
             Buy("BuyEnt",1,0,Market,Day)
        End If

        ExitLong("TakeProfitLong","BuyEnt",1,111,Limit,Day)
       
    End Sub

    However sometimes the ExitLong exits a position on the same day at the same price it was opened. I am using 111 as an exit price but I have also tried using EntryPrice+'some number' and then all my trades are exited on the same day and at the same price.

    What can be the reason for this, is some thing wrong with my code or the ExitLong function??

    Best regards,

    David Hubbard
    New Member
    New Member
    Posts:6

    --
    09-13-2008 05:40 PM
    I once had a similar but different problem.  My exits were showing exits at a price completely outside the range.  It turned out that the data it was reading in was out of date order.  I fixed the datafile and everything worked fine.  I would advise looking at your data file and see if there any problems there.
    You are not authorized to post a reply.


     TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved   Terms Of Use  Privacy Statement