If LongOnMarket Then
LongProfit =(Close-(TradePrice+MSP))
GRAPH (LongProfit) Coloured(100, 255, 150) AS "LongProfit"
EndIf
If ShortOnMarket Then
ShortProfit =((TradePrice-MSP)-Close)
GRAPH (ShortProfit) Coloured(100, 255, 150) AS "ShortProfit"
Endif
Hallo liebe PRTler,
scheinbar werden OnMarket Anweisungen in Verbindung mit Graph ignoriert.
Wie auf dem Screenshot in der Anlage zu sehen; Flat, dennoch wird der Graph-Befehl ausgeführt. Mir ist klar, dass immer der letzte Tradeprice herangezogen wird, mir geht es einfach um die Graph-Ausführung als solche.
Über Hilfe bei meinem Verständnis-Problem würde ich mich freuen.
Danke vorab und schon einmal ein schönes Wochenende.
Liebe Grüße
Rainer
Versuchen Sie, beide GRAPH-Befehle ans Ende nach der letzten Zeile zu verschieben.
Guten Morgen Roberto,
WOW, Danke für die superschnelle Antwort, sehr nett.
Der Code steht schon am Ende. Bin ratlos.
Habe auch eine Zwischenlösung versucht, aber selbst die Steuerungs-Variablen, die korrekt gesetzt werden, werden ignoriert?
Bin ratlos.
Nochmals Danke und liebe Grüße
Rainer
// nach Order
If LongOnMarket Then
SPLC = 1
LongProfit =(Close-(TradePrice+MSP))
Else
SPLC = 0
EndIf
If ShortOnMarket Then
SPSC = 1
ShortProfit =((TradePrice-MSP)-Close)
Else
SPSC = 0
EndIf
// am Ende
If SPLC = 1 Then
GRAPH (LongProfit) Coloured(100, 255, 150) AS “LongProfit”
EndIf
If SPSC = 1 Then
GRAPH (ShortProfit) Coloured(100, 255, 150) AS “ShortProfit”
Endif
// Reset am Code-Anfang
SPLC = 0
SPSC = 0
LongProfit = 0
ShortProfit = 0
// Nach Order-Platzierung
If LongOnMarket Then
SPLC = 1
LongProfit =(Close-(TradePrice+MSP))
Else
SPLC = 0
EndIf
If ShortOnMarket Then
SPSC = 1
ShortProfit =((TradePrice-MSP)-Close)
Else
SPSC = 0
EndIf
// Am absoluten Code-Ende Ende
GRAPH (SPLC) Coloured(255, 250, 205) AS "SPLC"
GRAPH (SPSC) Coloured(255, 250, 205) AS "SPSC"
If SPLC = 1 Then
GRAPH (LongProfit) Coloured(100, 255, 150) AS "LongProfit"
EndIf
If SPSC = 1 Then
GRAPH (ShortProfit) Coloured(100, 255, 150) AS "ShortProfit"
Endif
// Festlegen der Code-Parameter
DEFPARAM CumulateOrders = False // Kumulieren von Positionen deaktiviert
LP = 20
SP = 20
MSP = 3
SPLC = 0
SPSC = 0
LongProfit = 0
ShortProfit = 0
// Bedingungen zum Einstieg in Long-Positionen
indicator1 = CCI[LP]
c1 = (indicator1 CROSSES OVER -100) And (Close CROSSES OVER Average[LP](Close))
// Bedingungen zum Einstieg in Short-Positionen
indicator2 = CCI[SP]
c2 = (indicator2 CROSSES UNDER 100) And (Close CROSSES UNDER Average[SP](Close))
IF c1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF c2 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
IF c2 THEN
SELL AT MARKET
ENDIF
IF c1 THEN
EXITSHORT AT MARKET
ENDIF
If LongOnMarket Then
SPLC = 1
LongProfit =(Close-(TradePrice+MSP))
Else
SPLC = 0
LongProfit = 0
EndIf
If ShortOnMarket Then
SPSC = 1
ShortProfit =((TradePrice-MSP)-Close)
Else
SPSC = 0
ShortProfit = 0
EndIf
// Stops und Targets
SET STOP %LOSS 0.5
SET TARGET %PROFIT 0.7
If SPLC = 1 Then
GRAPH (LongProfit) Coloured(100, 255, 150) AS "LongProfit"
EndIf
If SPSC = 1 Then
GRAPH (ShortProfit) Coloured(100, 255, 150) AS "ShortProfit"
Endif
// Auch FLat wird stets der Graph-Befehl ausgeführt - Ratlos
Hallo nochmal,
habe es mit Testen gelöst.
Ist ein Graph-Befehl während einer Sitzung einmal aktiv, bleibt er stets aktiv. Insofern setze ich eben den Wert entsprechend bei Flat auf 0.
So gehts.
Liebe Grüße und schönes Wochenende.
Rainer