MarcParticipant
Average
Hi together,
I’d like to share my code with you and want to know if there is any mistake within this code?
Here are the rules for this system:
Enter Long when:
- When RSI with Period 2 is below or equal 10 on previous periods close
- When RSI with Period 2 is above or equal 10 at close of current periods close
- When IBS is below or equal 50 on previous periods close
- When IBS is above or equal 50 at close of current period
- Open Long at next bar open
Exit Long when:
- RSI rises above 80 at close of previous period, close position at next bar open
Enter Short when:
- When RSI with Period 2 is above or equal 90 on previous periods close
- When RSI with Period 2 is below or equal 90 at close of current periods close
- When IBS is above or equal 50 on previous periods close
- When IBS is below or equal 50 at close of current period
- Open Short at next bar open
Exit Short when:
- RSI falls below 20 at close of previous period, close position at next bar open
Here is the code:
//INDICATOR
IBS = (Close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[2](close)
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 90
RSISHORTEXIT = 20
//ENTRY CONDITION
l1 = not LongOnMarket
l1 = l1 and IBS[1] >= IBSLONGTRIGGER[1] and IBS[2] <= IBSLONGTRIGGER[2] and RSI2[1] >= RSILONGTRIGGER[1] and RSI2[2] <= RSILONGTRIGGER[2]
b1 = not ShortOnMarket
b1 = b1 and IBS[1] <= IBSSHORTTRIGGER[1] and IBS[2]>= IBSSHORTTRIGGER[2] and RSI2[1] <= RSISHORTTRIGGER[1] and RSI2[2] >= RSISHORTTRIGGER[2]
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2[1] >= RSILONGEXIT[1]
b2 = ShortOnMarket
b2 = RSI2[1] <= RSISHORTEXIT[1]
//LONG ENTRY
IF NOT LongOnMarket AND l1 THEN
BUY 1 CONTRACTS AT MARKET NextBarOPen
ENDIF
//LONG EXIT
If LongOnMarket AND l2 THEN
SELL AT MARKET NextBarOpen
ENDIF
//SHORT ENRTRY
IF NOT ShortOnMarket AND b1 THEN
SELLSHORT 1 CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF ShortOnMarket AND b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF
MarcParticipant
Average
Code amended…
//INDICATOR
IBS = (Close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[2](close)
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 90
RSISHORTEXIT = 20
//ENTRY CONDITION
l1 = not LongOnMarket
l1 = l1 and IBS[1] >= IBSLONGTRIGGER[1]
l1 = l1 and IBS[2] <= IBSLONGTRIGGER[2]
l1 = l1 and RSI2[1] >= RSILONGTRIGGER[1]
l1 = l1 and RSI2[2] <= RSILONGTRIGGER[2]
b1 = not ShortOnMarket
b1 = b1 and IBS[1] <= IBSSHORTTRIGGER[1]
b1 = b1 and IBS[2]>= IBSSHORTTRIGGER[2]
b1 = b1 and RSI2[1] <= RSISHORTTRIGGER[1]
b1 = b1 and RSI2[2] >= RSISHORTTRIGGER[2]
//EXIT CONDITION
l2 = LongOnMarket
l2 = l2 and RSI2[1] >= RSILONGEXIT[1]
b2 = ShortOnMarket
b2 = b2 and RSI2[1] <= RSISHORTEXIT[1]
//LONG ENTRY
IF l1 THEN
BUY 1 CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL AT MARKET NextBarOpen
ENDIF
//SHORT ENRTRY
IF b1 THEN
SELLSHORT 1 CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF
Deutsch im deutschen Forum, englisch im englischen Forum. 🙂
für welches finanzinstrument möchtest du diese strategie anwenden – ausserdem noch interessant in welchem zeitfenster soll es laufen?
Hey Mast,
folgendes ist mir aufgefallen:
//ENTRY CONDITION
l1 = not LongOnMarket
l2 = l1 and IBS[1] >= IBSLONGTRIGGER[1]
l3 = l2 and IBS[2] <= IBSLONGTRIGGER[2]
l4 = l3 and RSI2[1] >= RSILONGTRIGGER[1]
l5 = l4 and RSI2[2] <= RSILONGTRIGGER[2]
[...]
Meinst Du soetwas?
MarcParticipant
Average
Hallo zusammen, also natürlich möchte ich möglichst beliebige Instrumente handeln. Den TF sehe ich bei 1h, 4h und 1D, wobei es interessant wäre dies auch unter 2h zu testen.
Sicher würde es, je nach Instrument dann auch Sinn machen Zeiten fest zu legen wann gehandelt werden soll.
Aktuell nutze ich eine Demo mit EOD Daten und wollte mal die 14 Tage Version nutzen um eben kleinere TF zu testen.
bzgl des codeschnipsels muss ich mich mal rein denken…habe gestern erst angefangen mich mit prorealcode zu befassen.
vg marc
MarcParticipant
Average
Ich habe übrigens den Code ein wenig geändert…
Hier ist nun ein MA-Filter drin:
//INDICATOR
IBS = (Close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[2](close)
MA = average[maperiod](close)
//CONTRACTSIZE
X = 10
//MOVING AVERAGE PERIOD
maperiod = 144
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 90
RSISHORTEXIT = 20
//ENTRY CONDITION
l1 = NOT LongOnMarket
l1 = l1 and IBS > IBSLONGTRIGGER
l1 = IBS[1] < IBSLONGTRIGGER[1]
l1 = l1 and RSI2 > RSILONGTRIGGER
l1 = RSI2[1] < RSILONGTRIGGER[1]
l1 = l1 and low[1] > MA
b1 = NOT ShortOnMarket
b1 = b1 and IBS < IBSSHORTTRIGGER
b1 = IBS[1] > IBSSHORTTRIGGER[1]
b1 = b1 and RSI2 < RSISHORTTRIGGER
b1 = RSI2[1] > RSISHORTTRIGGER[1]
b1 = b1 and high [1] < MA
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2 > RSILONGEXIT
b2 = ShortOnMarket
b2 = RSI2 < RSISHORTEXIT
//LONG ENTRY
IF l1 THEN
BUY X CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT ENTRY
IF b1 THEN
SELLSHORT X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF
MarcParticipant
Average
DEFPARAM CumulateOrders = True
//INDICATOR
IBS = (Close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[2](close)
MA = average[maperiod](close)
//CONTRACTSIZE
X = 1
//MOVING AVERAGE PERIOD
maperiod = 200
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 90
RSISHORTEXIT = 20
//ENTRY CONDITION
l1 = NOT LongOnMarket
l1 = l1 and IBS > IBSLONGTRIGGER
l1 = IBS[1] < IBSLONGTRIGGER[1]
l1 = l1 and RSI2 > RSILONGTRIGGER
l1 = RSI2[1] < RSILONGTRIGGER[1]
l1 = l1 and low[1] > MA
b1 = NOT ShortOnMarket
b1 = b1 and IBS < IBSSHORTTRIGGER
b1 = IBS[1] > IBSSHORTTRIGGER[1]
b1 = b1 and RSI2 < RSISHORTTRIGGER
b1 = RSI2[1] > RSISHORTTRIGGER[1]
b1 = b1 and high [1] < MA
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2 > RSILONGEXIT
b2 = ShortOnMarket
b2 = RSI2 < RSISHORTEXIT
//LONG ENTRY
IF l1 THEN
BUY X CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT ENTRY
IF b1 THEN
SELLSHORT X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF
Hi Maste
habs mal im dow im m1 durchgezogen
PF 1,16
TQ 70 %
6000 Trades aber crv 1:2, 4€ GW : 9,5, € verlust
im H1 PF 0,6
crv von 1:4
Gruß
MarcParticipant
Average
Hallo axmichi,
Berauschend ist das nicht…wahrscheinlich ist 1 Minute klein als TF um da wirklich aussagekräftige Ergebnisse zu bekommen. Im Dax lief es beim Taily TF ganz gut mit einem ordentlichen PF von 3,96.
ich habe mal die trialversiob mit Echtzeitdaten bzw. den untertägigen Daten freischalten lassen und teste es mal heute selber aus.
Das Grundgerüst dieses Systems beruht auf der Idee von Larry Williams RSI2a-Strategie.
vg Marc
Du weißt das du traillingstops usw, nicht mehr verwenden brauchst, da sie nicht mehr greifen, akzeptiert werden. Thema garantierte Stops
MarcParticipant
Average
Du weißt das du traillingstops usw, nicht mehr verwenden brauchst, da sie nicht mehr greifen, akzeptiert werden. Thema garantierte Stops
Auf Stopps habe ich mich seltenst verlassen dürfen. Ich benutze da lieber valide Signale…wie im o.g. System
MarcParticipant
Average
Gedächtnisstütze:
Einige Parameter angepasst:
RSI Close mit HA-Berechnung
DEFPARAM CumulateOrders = false
//INDICATOR
IBS = (close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[2]((open+close+low+high)/4)
MA = average[maperiod](close)
//CONTRACTSIZE
X = 1
//MOVING AVERAGE PERIOD
maperiod = 200
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = 10
RSILONGEXIT = 80
RSISHORTTRIGGER = 95
RSISHORTEXIT = 50
//ENTRY CONDITION
l1 = NOT LongOnMarket
l1 = l1 and IBS > IBSLONGTRIGGER
l1 = IBS[1] < IBSLONGTRIGGER[1]
l1 = l1 and RSI2 > RSILONGTRIGGER
l1 = RSI2[1] < RSILONGTRIGGER[1]
l1 = l1 and low[1] > MA
b1 = NOT ShortOnMarket
b1 = b1 and IBS < IBSSHORTTRIGGER
b1 = IBS[1] > IBSSHORTTRIGGER[1]
b1 = b1 and RSI2 < RSISHORTTRIGGER
b1 = RSI2[1] > RSISHORTTRIGGER[1]
b1 = b1 and high [1] < MA
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2 > RSILONGEXIT
b2 = ShortOnMarket
b2 = RSI2 < RSISHORTEXIT
//LONG ENTRY
IF l1 THEN
BUY X CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT ENTRY
IF b1 THEN
SELLSHORT X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF
MarcParticipant
Average
here antoher code with some variables for testing.
DEFPARAM CumulateOrders = false
//INDICATOR
IBS = (close-Low) / (HIGH-LOW) * 100
RSI2 = RSI[RSIPeriod]((open+close+low+high)/4)
MA = average[MAPeriod](close)
//CONTRACTSIZE
X = 1
//SIGNAL
IBSLONGTRIGGER = 50
IBSSHORTTRIGGER = 50
RSILONGTRIGGER = RSILT
RSILONGEXIT = RSILE
RSISHORTTRIGGER = RSIST
RSISHORTEXIT = RSISE
//ENTRY CONDITION
l1 = NOT LongOnMarket
l1 = l1 and IBS > IBSLONGTRIGGER
l1 = IBS[1] < IBSLONGTRIGGER[1]
l1 = l1 and RSI2 > RSILONGTRIGGER
l1 = RSI2[1] < RSILONGTRIGGER[1]
l1 = l1 and low[1] > MA
b1 = NOT ShortOnMarket
b1 = b1 and IBS < IBSSHORTTRIGGER
b1 = IBS[1] > IBSSHORTTRIGGER[1]
b1 = b1 and RSI2 < RSISHORTTRIGGER
b1 = RSI2[1] > RSISHORTTRIGGER[1]
b1 = b1 and high [1] < MA
//EXIT CONDITION
l2 = LongOnMarket
l2 = RSI2 > RSILONGEXIT
b2 = ShortOnMarket
b2 = RSI2 < RSISHORTEXIT
//LONG ENTRY
IF l1 THEN
BUY X CONTRACTS AT MARKET NextBarOpen
ENDIF
//LONG EXIT
If l2 THEN
SELL X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT ENTRY
IF b1 THEN
SELLSHORT X CONTRACTS AT MARKET NextBarOpen
ENDIF
//SHORT EXIT
IF b2 THEN
EXITSHORT AT MARKET NextBarOpen
ENDIF