Hmm, but this is my exit code: Code: If Close < Average(Close,50) and Close[1] > Average(Close,50) then Print("Selling") ; Sell next bar at market ; So essentially I'm saying if we have an open position and then Close falls below the Average then we sell next bar at market which unless I'm mistaken (and I might be) that should sell an equal amount to what it bought and exit the trade? Thanks
Try instead:- Code: If MarketPosition = 1 and Close < Average(Close,50) and Close[1] > Average(Close,50) then Print("Selling") ; Sell next bar at market ;
Same issue I'm afraid. I'm wondering if there is something wrong with the platform as I have to remove and add the strategy each time I want to test it as well, otherwise it won't appear on the chart. This kind of logic also works fine in other backtesting tools. I've submitted a ticket with TradeStation Global anyway. Thanks for the help.
Your code is the issue, the conditional only worked on the print statement. Try it like this: Code: If Close < Average(Close,50) and Close[1] > Average(Close,50) then begin Print("Selling") ; Sell next bar at market ; end;
ok some of your problem is marketposition < it only occurs after the fact. if you want market position to work make it a variable var:mp(0): then define what mp is for example; if average(c, 10) > average(c, 10)[1]then mp = 1;
1. Use Tradestation 9.5, NOT TS 10.0. 2. Learn at least the rudiments of Easy Language. There are many Youtube videos. 3. Create a strategy that has a chance of working. (Yours doesn't) Best wishes...