Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 09.01.19
Stinky Stinky ist offline
Neues Mitglied
 
Registriert seit: Jan 2019
Beiträge: 1
Stinky befindet sich auf einem aufstrebenden Ast
Standard Frage zu meinem Script (TrailingStop)

Hallo zusammen, ich bin ganz neu im MetaEditor und hoffe das mir jemand hier aushelfen kann.

Ich probiere schon länger in meinem kleinen Script einen Trailing Stop einzufügen. Finde im Internet leider nichts evtl. kann mir hier jemand helfen.

Was ich Anfänger bis jetzt habe:

PHP-Code:

// Version 0.01
#property copyright "Copyright 2019, Laurent Häuslein"

input int TPPoints 100;
input int SLPoints 50;

input int RSIPeriods 14;
input int Top 70;
input int Bottom 30;
input int Magic 1;




int orderTicket

int OnInit()
  {

   return(
INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

   
  }

void OnTick(){
   
double rsi;
   
rsi iRSI(Symbol(), PERIOD_CURRENT,RSIPeriods,PRICE_CLOSE,0);

      if(
rsi Top) {
      
         if(
OrderSelect(orderTicket,SELECT_BY_TICKET) == true) {
            if(
OrderType() == OP_BUY) {
               
bool res OrderClose(OrderTicket(),OrderLots(),Bid,1000,clrNONE);
                  
orderTicket 0;
                  }            
               }
      if(
orderTicket <= 0) {
         
orderTicket executShort();
     }
     }
     else if(
rsi Bottom) {
         if(
OrderSelect(orderTicket,SELECT_BY_TICKET) == true) {
            if(
OrderType() == OP_SELL) {
               
bool res OrderClose(OrderTicket(),OrderLots(),Ask,1000,clrNONE);
                  
orderTicket 0;
                  }
               }
            if(
orderTicket <= 0) {
                
orderTicket executLong();
     }
     }
     }
     
     
     
int executShort () {
   
double entry Bid
   
double tp entry TPPoints Point;
   
double sl entry SLPoints Point;
   
   
int ticket;
   
ticket OrderSend(Symbol(), OP_SELL,Lots,entry,1000,sl,tp,"OP_SELL",Magic,0,clrNONE);
   return 
ticket;
  }

int executLong () {
   
double entry Bid;
   
double tp entry TPPoints Point;
   
double sl entry SLPoints Point;
  
   
int ticket;
   
ticket OrderSend(Symbol(), OP_BUY,Lots,entry,1000,sl,tp,"OP_SELL",Magic,0,clrNONE);
   return 
ticket;
  }