Tuesday, January 06, 2009     | Register
TradersStudio Forums
Subject: ExitLong gives strange results

You are not authorized to post a reply.   
Author Messages
agrqqq
Posts:1

08-19-2008 7:37 AM Alert 

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,

Cowpux
Posts:6

09-13-2008 5:40 PM Alert 
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.
Forums > Technical Trading > Developing Trading Systems > ExitLong gives strange results



ActiveForums 3.6
TradersStudio® Copyright 2004-2009 All Rights Reserved   |  Privacy Statement  |  Terms Of Use