Buongiorno, devo programmare un codice in powerlanguage per Multicharts dove in fase di ottimizzazione della strategia mi fa uno scanner coi vari pattern di prezzo. Il problema che non riesco a scrivere il codice completo.. qualcuno mi può aiutare?
//Pattern Base "PtnBaseSA"
Var:
opend0(0), opend1(1),
highd0(0), highd1(0);
Array:
definizioneptn[4](0);
opend0=opens(0);
opend1=opens(1);
highd0=highs(0);
highd1=highs(1);
definizioneptn[1] = ((highd0-opend0)>((highd1-opend1)*1));
definizioneptn[2] = ((highd0-opend0)>((highd1-opend1)*1.5));
definizioneptn[3] = true;
definizioneptn[4] = false;
PtnBaseSA = definizioneptn[numeropattern];
//mia strategia grezza
Input: MyPtnLY(4), MyPtnSY(4), MyPtnLN(4), MyPtnSN(4);
Input: MyStardTrade(00), MyEndTrade(00), MyStartPause(1200), MyEndPause(1100); //inputs orari della finestra temporale
Input: MyStop(100), MyProfit(0);
If Time > MyStardTrade and Time < MyEndTrade and (Time < MyStartPause or Time > MyEndPause) then begin //fasce orarie in cui operare
If PtnBaseSA(MyPtnLY) = True and PtnBaseSA(MyPtnLN) = False then buy next bar at Highd(o) stop; //compra se siamo long al massimo di giornata
If PtnBaseSA(MyPtnSY) = True and PtnBaseSA(MyPtnSN) = False then sellshort next bar at Lowd(o) stop; //compra se siamo short al minimo di giornata
end;
Setstopcontract;
If MyStop > 0 then setstoploss(MyStop);
If MyProfit > 0 then setprofittarget(MyProfit);
La funzione scritta sopra mi da errore e non capisco perchè..
Grazie a tutti.
Giosuè
//Pattern Base "PtnBaseSA"
Var:
opend0(0), opend1(1),
highd0(0), highd1(0);
Array:
definizioneptn[4](0);
opend0=opens(0);
opend1=opens(1);
highd0=highs(0);
highd1=highs(1);
definizioneptn[1] = ((highd0-opend0)>((highd1-opend1)*1));
definizioneptn[2] = ((highd0-opend0)>((highd1-opend1)*1.5));
definizioneptn[3] = true;
definizioneptn[4] = false;
PtnBaseSA = definizioneptn[numeropattern];
//mia strategia grezza
Input: MyPtnLY(4), MyPtnSY(4), MyPtnLN(4), MyPtnSN(4);
Input: MyStardTrade(00), MyEndTrade(00), MyStartPause(1200), MyEndPause(1100); //inputs orari della finestra temporale
Input: MyStop(100), MyProfit(0);
If Time > MyStardTrade and Time < MyEndTrade and (Time < MyStartPause or Time > MyEndPause) then begin //fasce orarie in cui operare
If PtnBaseSA(MyPtnLY) = True and PtnBaseSA(MyPtnLN) = False then buy next bar at Highd(o) stop; //compra se siamo long al massimo di giornata
If PtnBaseSA(MyPtnSY) = True and PtnBaseSA(MyPtnSN) = False then sellshort next bar at Lowd(o) stop; //compra se siamo short al minimo di giornata
end;
Setstopcontract;
If MyStop > 0 then setstoploss(MyStop);
If MyProfit > 0 then setprofittarget(MyProfit);
La funzione scritta sopra mi da errore e non capisco perchè..
Grazie a tutti.
Giosuè