After trading market manually for few years, I decided to try to diversify using mechanical strategies.
As I am quite new to Tradestation and I am not a programmer, I am a bit stuck with the coding. Is anyone here that would be so kind and pointed me to the right direction?
I am trying to program easy breakout system that will use 2 timeframes. The software will look for setups at higher timeframe and trade them on lower timeframe. I am including the code I have come up so far. At this moment the code is just a fragment of future system, so I am sure the logic could be programmed using one timeframe only. But that is not what I want to accomplish as I want to add latter some more conditions that require using 2 timeframes.
Here are my problems:
1. I want to write trades to txt file, but I just cannot figure out how to write the executions AFTER the trade is closed. This is the last part of the code and this one is not working yet. TS is writing into file, but I am not able to code conditions that this part of the script will be run only once after the trade is closed and system knows exit prices (either on stop-loss or profit target).
2. Would the entering logic work in real life? That means is is all right that TradeStation will generate stop order on each 3 minute bar?
Should I use condition like And close 0 then begin
StrOut = "Entry price: " + NumtoStr(EntryPrice(0), 2) + " Exit price: " + NumtoStr(ExitPrice(0), 2) + " P/L: " + NumtoStr(PositionProfit(0), 2) + NewLine;
FileAppend(Txtfile, StrOut);
end;
}