Hello all
So I just started to (try to) transfer some of my systems from GSB to TS. I am running into an issue with the TS code however. For the system below, I
want to exit every trade at 2200 hrs (local GMT +1 time). It works perfectly fine on GSB. But on TS, the code generated by GSB, does not work
flawlessly. The trades that are entered after 22:00 (eg at 22:20), are exited on the same bar/day. In GSB, this is handled correctly (given my
inputs), ie all trades are exited at 22:00, either the following day if the trade is entered before 00:00, or the same day if the trade is entered
after 00:00.
Question: How could I get TS to replicate this exactly? Just cutting and pasting the code as is does not seem to work. And as I am a complete
illiterate in EL, I don't know how to adjust the code to accomplish this. Could somebody please be kind and let me know how the code needs to be
adjusted in order to create the identical trade signals in TS as I am getting in GSB. Thanks in advance.
TS code:
////Contract's Session Close
If (TimeHms >= 220000) Then
Begin
BuyToCover this bar on close;
Sell this bar on close;
End;
SetExitOnClose;
// Exit Minutes
If BarDateTime.ELDateTimeEx >= tradeExitTime Then
Begin
BuyToCover this bar on close;
Sell this bar on close;
tradeExitTime = 1000000000;
End;
// Trading Dates
If Not ((dateYmd >= 20000101 And dateYmd <= 20181231)) Then
Begin
BuyToCover this bar on close;
Sell this bar on close;
End;
// Result and decision
result = ((GSB_Norm2(TrueRange of Data(i1Data), 11, 100) of Data(i1Data) * i1Weight) * ((GSB_Norm2(GSB_FastK(i2stockLength) of Data(i2Data), 11, 100)
of Data(i2Data) * i2Weight) * ((GSB_Norm2(GSB_Decycler(i3cutoff) of Data(i3Data), 11, 100) of Data(i3Data) * i3Weight) * (GSB_Norm2(GSB_Highest(High,
i4length) of Data(i4Data), 11, 100) of Data(i4Data) * i4Weight))));
result = IFF(AbsValue(result) > zs, result, 0);
decision = GSB_Decision(result, 1, entryParams);
sfResult = GSB_Norm2(GSB_CloseOverPrevCloseD of Data(iSFData), 11, 100) of Data(iSFData) * iSFWeight;
sfResult = IFF(AbsValue(sfResult) > zs, sfResult, 0);
sfDecision = GSB_Decision(sfResult, 2, sfEntryLevel);
// Entry-filter check
If (dateYmd > beginDate And dateYmd <= endDate)
And ((dateYmd >= 20000101 And dateYmd <= 20181231))
And (Not (TimeHms >= 220000 And TimeHms <= 220001)) Then
Begin
// Buy/Sell
If decision = 1 And sfDecision = 1 Then
Begin
Buy("Long entry") 1 contracts this bar on close;
tradeExitTime = GSB_CalcDateTime(BarDateTime.ELDateTimeEx, exitMinutesValue);
End
Else If decision = -1 And sfDecision = -1 Then
Begin
SellShort("Short entry") 1 contracts this bar on close;
tradeExitTime = GSB_CalcDateTime(BarDateTime.ELDateTimeEx, exitMinutesValue);
End;
End;
|