|
Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4. |
|
Themen-Optionen | Thema durchsuchen | Ansicht |
|
|||
Stop/Loss an Unterstützung ausrichten
Hallo,
habe eine Frage. Ich habe einen Indikator und einen EA. Ich habe mir diesen Indikator zur Berechnung der Unterstützung und der Widerstände installiert https://broker-bewertungen.de/files/...stance_MT4.zip hier die Erklärung: https://broker-bewertungen.de/downlo...standsbereiche Hier der Code vom Indikator: //+------------------------------------------------------------------+ //| Support and Resistance | //| Copyright © 2004 Barry Stander | //| http://myweb.absa.co.za/stander/4meta/ | //+------------------------------------------------------------------+ #property copyright "Click here: Barry Stander" #property link "http://myweb.absa.co.za/stander/4meta/" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- buffers double v1[]; double v2[]; double val1; double val2; int i; //---- int init() { IndicatorBuffers(2); //---- drawing settings SetIndexArrow(0, 119); SetIndexArrow(1, 119); SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red); SetIndexDrawBegin(0,i-1); SetIndexBuffer(0, v1); SetIndexLabel(0,"Resistance"); SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue); SetIndexDrawBegin(1,i-1); SetIndexBuffer(1, v2); SetIndexLabel(1,"Support"); return(0); } int start() { i=Bars; while(i>=0) { val1 = iFractals(NULL, 0, MODE_UPPER,i); if (val1 > 0) v1[i]=High[i]; else v1[i] = v1[i+1]; val2 = iFractals(NULL, 0, MODE_LOWER,i); if (val2 > 0) v2[i]=Low[i]; else v2[i] = v2[i+1]; i--; } return(0); } //+------------------------------------------------------------------+ und so habe ich den in meinen EA eingebunden: double Resist=iCustom(0,0,"Support and Resistance (Barry)",0,1); Wie kann ich nun den Stop/Loss - aller offenen BUY Positionen des EAs an der blauen "Support" Linie ausrichten und - aller offenen SELL Positionen des EAs an der roten "Resistance" Linie ausrichten Kann mir jmd da sagen wie ich das in einen EA einbauen kann ? |
|
|||
Alle in Urlaub ?
Alle in Urlaub ?
|
|
|||
fehlender "indent style" ist meißt auch nicht förderlich zum coder-ködern
|
|
|||
??
Was bedeutet das ?
Ich bin leider kein Profi auf dem Gebiet? Was soll ich noch liefern ? |
|
|||
Damit ist gemeint, wenn du Code postest, so benutze bitte die entsprechenden Tags mit übersichtlichen Einrückungen.
Etwa so: Code:
//+------------------------------------------------------------------+ //| Support and Resistance | //| Copyright © 2004 Barry Stander | //| http://myweb.absa.co.za/stander/4meta/ | //+------------------------------------------------------------------+ #property copyright "Click here: Barry Stander" #property link "http://myweb.absa.co.za/stander/4meta/" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Red #property indicator_color2 Blue //---- buffers double v1[]; double v2[]; double val1; double val2; int i; //---- int init() { IndicatorBuffers(2); //---- drawing settings SetIndexArrow(0, 119); SetIndexArrow(1, 119); SetIndexStyle(0,DRAW_ARROW,STYLE_DOT,1,Red); SetIndexDrawBegin(0,i-1); SetIndexBuffer(0, v1); SetIndexLabel(0,"Resistance"); SetIndexStyle(1,DRAW_ARROW,STYLE_DOT,1,Blue); SetIndexDrawBegin(1,i-1); SetIndexBuffer(1, v2); SetIndexLabel(1,"Support"); return(0); } int start() { i=Bars; while(i>=0) { val1 = iFractals(NULL, 0, MODE_UPPER,i); if (val1 > 0) v1[i]=High[i]; else v1[i] = v1[i+1]; val2 = iFractals(NULL, 0, MODE_LOWER,i); if (val2 > 0) v2[i]=Low[i]; else v2[i] = v2[i+1]; i--; } return(0); } //+------------------------------------------------------------------+ |
|
|||
So Julia,
hab es grad mal getestet und bei mir läuft es soweit. Der Aufruf: Code:
double test = iCustom(NULL,0,"Support and Resistance (Barry)",0,0); Code:
double test = iCustom(NULL,0,"Support and Resistance (Barry)",1,0); Jetzt zu deinen Fragen: Zitat:
Code:
int i; int count = OrdersTotal(); double linie_widerstand = double test = iCustom(NULL,0,"Support and Resistance (Barry)",0,0); double linie_support = double test = iCustom(NULL,0,"Support and Resistance (Barry)",1,0); for(i=0; i<count; i++) { OrderSelect(i,SELECT_BY_POS); //Nur Order bearbeiten, die zu deinem EA gehören! if(OrderMagicNumber() == MagicNumber_von_deinem_EA) { //Stoploss auf die Unterstützungs-/Widerstandslinie setzen if(OrderType() == OP_BUY) OrderModify(OrderTicket(),OrderOpenPrice(),linie_support,OrderTakeProfit(),0); else OrderModify(OrderTicket(),OrderOpenPrice(),linie_widerstand,OrderTakeProfit(),0); } } |
|
|||
EDIT:
Muss natürlich so sein: Code:
double linie_widerstand = iCustom(NULL,0,"Support and Resistance (Barry)",0,0); double linie_support = iCustom(NULL,0,"Support and Resistance (Barry)",1,0); |
Lesezeichen |
Stichworte |
mql4, programmierung, programmierung metatrader, programmierung mql4, stoploss, stoploss unterstützung, unterstützung, widerstände |
|
|