Sto iniziando a giochicchiare con la OL.
Sono riuscito ad importare la prima strategia da TS ma volendo gestire anche gli Input direttamente in OL ho provato a farla direttamente in nativo in OL.
Ho due domande veloci per chi è esperto:
1 Nel comando Print per fare il comando Debug ho inserito delle variabili ma non le vedo poi nel PrintLog.
Per esempio nel codice:
Print("It has passed here PS Flat", Date, Mymaturity);
Vedo nel log il testo fisso ma non il valore della variabile Date nè della variabile Mymaturity.
2 La seconda domanda è se funzionano tutti i comandi di EL.
Per esempio il codice mi entra sia nel primo che nel secondo IF ma non mi entra nel terzo IF ovvero quello dove c'è il comando dayofweek di cui sotto ma non mi sembrano ci siano errori:
If dayofweek(date)=prefDayBuy Then Begin
Ecco il codice, poche righe ma non ne sto uscendo vivo:
int Bin, GroupN = 0;
double StrikeSellPut, StrikeBuyPut, nCon;
OLDate MyMaturity;
input double DeltaPutSell = 0.4, DeltaPutBuy = 0.1;
input int Scadenza = 6, prefdaybuy = 5, prefdaysell = 3, capitale = 10000;
If Position = Flat then begin
MyMaturity = GetMaturity(MinDays, Scadenza);
Print("It has passed here PS Flat", Date, Mymaturity);
If MyMaturity - Date <=7 then Begin
StrikeSellPut = GetStrike(MyMaturity, put, Delta, DeltaPutSell);
StrikeBuyPut = GetStrike(MyMaturity, put, Delta, DeltaPutBuy);
Print("It has passed here Mymaturity 7", dayofweek(date), prefdaybuy);
If dayofweek(date)=prefDayBuy Then Begin
Print("It has passed here Buy!");
Bin = Sell(Put, StrikeSellPut, MyMaturity, 1, GroupN, "BP-Long");
Bin = Buy(Put, StrikeBuyPut, MyMaturity, 1, GroupN, "BP-Long");
End;
End;
End;
If Position = Put and dayofweek(date)=prefDaySell Then begin
Print("It has passed here Sell!");
Exit(-1, "BP-Long", "Exit-L1");
End;
Grazie e buona serata
Claudio