hi guys
i need your help .
you can add Take Profit to this expert ?
thank you
this expert code :
//+------------------------------------------------------------------+
//| Copyright 2005, Gordago Software Corp. |
//| http://www.gordago.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, Gordago Software Corp."
#property link "http://www.gordago.com"
extern double StopLoss = 30;
extern double TrailingStop = 20;
extern double Lots = 0.1;
extern double RSI = 14;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
int cnt, ticket;
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
double diRSI=iRSI(NULL,0,RSI,PRICE_CLOSE,0);
double ifloatcurrent = iCustom(NULL,0,"Float",0,0);
double ifloatprevious = iCustom(NULL,0,"Float",1,0);
double iGentor=iCustom(NULL, 0, "GentorCCIM_v[1].0.1", Close, 0, 0);
int total=OrdersTotal();
if(total<1){
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
//trade EU and US sessions only
if(Hour() = 17) return(0);
if ((iGentor>0 && ifloatcurrent>0 && ifloatprevious>=0 && ifloatcurrent<ifloatprevious)){
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,0, "Float",16384,0,Green);
if(ticket>0){
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if ((iGentor0 && ifloatprevious>=0 && ifloatcurrent<ifloatprevious)){
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,0,"Float",16384,0,Red);
if(ticket>0) {
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
}
for(cnt=0;cnt<total;cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) {
if(OrderType()==OP_BUY){
if(TrailingStop>0) {if(Bid-OrderOpenPrice()>Point*TrailingStop) {
if(OrderStopLoss()<Bid-Point*TrailingStop) {
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}else{
if(TrailingStop>0) {if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) {
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) {
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
}do this
extern double StopLoss = 30;
extern double TrailingStop = 20;
extern double Lots = 0.1;
extern double RSI = 14;
extern double takeprofit 20;//or the amount you want
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,takeprofit * Point, "Float",16384,0,Green);
if(ticket>0){
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,takeprofit * Point,"Float",16384,0,Red);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi guys
i need your help .
you can add Take Profit to this expert ?
thank you
this expert code :
//+------------------------------------------------------------------+
//| Copyright 2005, Gordago Software Corp. |
//| http://www.gordago.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2005, Gordago Software Corp."
#property link "http://www.gordago.com"
extern double StopLoss = 30;
extern double TrailingStop = 20;
extern double Lots = 0.1;
extern double RSI = 14;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start(){
int cnt, ticket;
if(Bars<100){
Print("bars less than 100");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
if(StopLoss<10){
Print("StopLoss less than 10");
return(0);
}
double diRSI=iRSI(NULL,0,RSI,PRICE_CLOSE,0);
double ifloatcurrent = iCustom(NULL,0,"Float",0,0);
double ifloatprevious = iCustom(NULL,0,"Float",1,0);
double iGentor=iCustom(NULL, 0, "GentorCCIM_v[1].0.1", Close, 0, 0);
int total=OrdersTotal();
if(total<1){
if(AccountFreeMargin()<(1000*Lots)){
Print("We have no money. Free Margin = ", AccountFreeMargin());
return(0);
}
//trade EU and US sessions only
if(Hour() = 17) return(0);
if ((iGentor>0 && ifloatcurrent>0 && ifloatprevious>=0 && ifloatcurrent<ifloatprevious)){
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,0, "Float",16384,0,Green);
if(ticket>0){
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUY order opened : ",OrderOpenPrice());
}
else Print("Error opening BUY order : ",GetLastError());
return(0);
}
if ((iGentor0 && ifloatprevious>=0 && ifloatcurrent<ifloatprevious)){
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,0,"Float",16384,0,Red);
if(ticket>0) {
if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("SELL order opened : ",OrderOpenPrice());
}
else Print("Error opening SELL order : ",GetLastError());
return(0);
}
}
for(cnt=0;cnt<total;cnt++) {
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()) {
if(OrderType()==OP_BUY){
if(TrailingStop>0) {if(Bid-OrderOpenPrice()>Point*TrailingStop) {
if(OrderStopLoss()<Bid-Point*TrailingStop) {
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}else{
if(TrailingStop>0) {if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) {
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) {
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
}