Experts: Source Code V2

 

Source Code V2:

This is the 2nd version of Source Code

Author: programmer

 

Hi, are you shure about your code and the results?

you open sell with 400 SL and 2000 TP

OrderSend(Symbol(),OP_SELL,0.1,Bid,10,Bid+400*Point,Bid-2000*Point,

for other hand you open buy with 2000 SL and 400 TP?

OrderSend(Symbol(),OP_BUY,0.1,Ask,10,Ask-2000*Point,Ask+400*Point,

 

It is the same as a car without brakes and head without a brain.

 

Well check the jpeg image ... I just ran that code as long+short on EURUSD from 12th Jan 2011 till today on Alpari data with 90% confidence level. Gave me profits... I know there are still errors in the code.. I do not know how to add code to close trades that have been opened. If someone can add that part and post it back, it will help me to learn. Basically I want like this ... when the condition goes exactly opposite to what I have, I want the trade to close. I want to use TP but not a SL.


EURUSD/ 15min/Long+SHORT/54%Drawdown/12th Jan 2011 till today




 



After running the same code from 2011- 14th Jan till today on EURUSD 15 min (LONG ONLY), I get the above graphs.

Now my question is why does the code not open any trade on live testings. These are all demo testing. Yes I have written the codes. And I am confused. Help anyone rather than just bs me all around. It will help all of us. I am here to find the best practice EA that we can all create together.

 
borilunad:

It is the same as a car without brakes and head without a brain.


I do not hvae a closing order as I am not entirely sure how to write one. Will it be possible for your to add code to close trades when the condition goes exactly opposite to the opening order?
 
tg2007:
borilunad:

It is the same as a car without brakes and head without a brain.


I do not hvae a closing order as I am not entirely sure how to write one. Will it be possible for your to add code to close trades when the condition goes exactly opposite to the opening order?


Это несложно, но не спасает от слива! Your English Google: It is not difficult, but does not prevent drain!

I don't know exactly how to make Close in your case. I did only SL and TP, suitable for optimization.

//+------------------------------------------------------------------+
//|                                                  SourceCode2.mq4 |
//+------------------------------------------------------------------+
extern int SLb = 500;
extern int TPb = 200;
extern int SLs = 500;
extern int TPs = 200;
int init()
{
  return(0);
}
int deinit()
{  
  return(0);
}
int start()
{     
   int total = OrdersTotal();                  
   if (OrdersTotal() < 5)   // I wont open more than 4 trade per time.
      if(Hour() > 8 && Hour() < 17)  //Will trade during volatile times when people are usually awake
         if ( ( (iMA(NULL,15,3,0,MODE_EMA,PRICE_MEDIAN,0)) < 
         (iMA(NULL,15,34,0,MODE_EMA,PRICE_MEDIAN,0))) && 
         (iSAR(NULL, 15, 0.02, 0.2, 0) > High[0]) &&
         (iBearsPower(NULL,15,13,PRICE_CLOSE,0) < 0 && 
         iBearsPower(NULL,15,13,PRICE_CLOSE,0) > 
         iBearsPower(NULL,15,13,PRICE_CLOSE,1)))          
         OrderSend(Symbol(),OP_SELL,0.01,Bid,10,Bid+SLs*Point,Bid-TPs*Point,"Open a Sell Order",16384,0,Red); 
                                                                                // Risk/Reward sucks here..
      
   if (OrdersTotal() < 5)   // I wont open more than 1 trade per time.
      if(Hour() > 8 && Hour() < 17)  //Will trade during volatile times when people are usually awake
         if ( ( (iMA(NULL,15,3,0,MODE_EMA,PRICE_MEDIAN,0)) > 
         (iMA(NULL,15,34,0,MODE_EMA,PRICE_MEDIAN,0))) && 
         (iSAR(NULL, 15, 0.02, 0.2, 0) < Low[0]) && 
         (iBullsPower(NULL,15,13,PRICE_CLOSE,0) > 0 &&  
         iBullsPower(NULL,15,13,PRICE_CLOSE,0) < 
         iBullsPower(NULL,15,13,PRICE_CLOSE,1)))  
         OrderSend(Symbol(),OP_BUY,0.01,Ask,10,Ask-SLb*Point,Ask+TPb*Point,"Open a Buy Order",16384,0,Green);
                                                                                // Risk/Reward sucks here..
}
 
tg2007:



After running the same code from 2011- 14th Jan till today on EURUSD 15 min (LONG ONLY), I get the above graphs.

Now my question is why does the code not open any trade on live testings. These are all demo testing. Yes I have written the codes. And I am confused. Help anyone rather than just bs me all around. It will help all of us. I am here to find the best practice EA that we can all create together.


But a professional is worth a thousand amateurs.

 
  1. if (OrdersTotal() < 5)  
    This makes the EA incompatible with any other including itself on other charts
  2. Doesn't adjust TP, SL, or slippage for 4 vs 5 digit brokers.
  3. Incompatible with ECN brokers (open then set stops)
 

dont have the settings INPUTS ?????

 
borilunad:
tg2007:



After running the same code from 2011- 14th Jan till today on EURUSD 15 min (LONG ONLY), I get the above graphs.

Now my question is why does the code not open any trade on live testings. These are all demo testing. Yes I have written the codes. And I am confused. Help anyone rather than just bs me all around. It will help all of us. I am here to find the best practice EA that we can all create together.


But a professional is worth a thousand amateurs.


borilunad:
tg2007:



After running the same code from 2011- 14th Jan till today on EURUSD 15 min (LONG ONLY), I get the above graphs.

Now my question is why does the code not open any trade on live testings. These are all demo testing. Yes I have written the codes. And I am confused. Help anyone rather than just bs me all around. It will help all of us. I am here to find the best practice EA that we can all create together.


But a professional is worth a thousand amateurs.


Ah but a professional wouldn't be so crass as to believe that he is infallible. - And you never made any mistakes, or presumed any wrong things?
Reason: