Newbie wanting help!

 

I am new to this and have not done any programming since 1990ish on a 386 pc! So need help just getting started.

I am wanting a stratergy that will buy when the price of the current bar goes above the price of the last bar high and then sell with a limit of 1pip! It's part of a stratergy I am trying to develop. It will in the end only do this when the previous bar close is above the previous bar open and it opened above the 15EMA. But if some one can point me in the right direction to get started on it buying above the last bar. It must buy striaght away and not wait for the next bar etc.

Thanks in advance - Jim

p.s. if there is someone can point me in the direction of a current written stratergy then I will just copy bits of code from that.

My email address is jim @ thebrays.co.uk (with no spaces).

 

Have you looked in the code base?

 
Ickyrus:

Have you looked in the code base?


Tried but so many codes cant find one.
 

JB

This is close to what you want https://www.mql5.com/en/code/10145

-BB-

 

AIS1 Trading Robot :

 
#define       A.System.Strategy         "A System: EURUSD Daily Metrics"                                       //<  7>

...

#define       acs.Symbol                "EURUSD"                                                               //< 16>

...
 
#define       aci.Index.1               7                                                                      //< 20>

...
 
int           aci.Timeframe             []  = { 0 , 1 , 5 , 15 , 30 , 60 , 240 , 1440 , 10080 , 43200 }      ; //< 22>

...
 
int    ali.Period.1      = aci.Timeframe           [ aci.Index.1         ]                                   ; //< 98>

...
 
double ald.Low.1         = iLow       ( acs.Symbol , ali.Period.1 , 1    )                                   ; //<101>
double ald.High.1        = iHigh      ( acs.Symbol , ali.Period.1 , 1    )                                   ; //<102>
double ald.Close.1       = iClose     ( acs.Symbol , ali.Period.1 , 1    )                                   ; //<103>

...
 
double ald.Average.1     =            ( ald.High.1 + ald.Low.1           ) / 2                               ; //<109>

...
 
int    ali.Command       = EMPTY                                                                             ; //<124>

...
 
//< 7.6. Strategy Logic >--------------------------------------------------------------------------------------//<161>
                                                                                                               //<162>
if ( OrdersTotal () > 0             )                                                                 return ; //<163>
                                                                                                               //<164>
if ( ald.Close.1  > ald.Average.1   )                                                                          //<165>
if ( ald.QuoteAsk > ald.High.1      )                                                                          //<166>
   { ali.Command  = OP_BUY                                                                                   ; //<167>

...
                                                                                                             } //<171>
                                                                                                               //<172>
if ( ald.Close.1  < ald.Average.1   )                                                                          //<173>
if ( ald.QuoteBid < ald.Low.1       )                                                                          //<174>
   { ali.Command  = OP_SELL                                                                                  ; //<175>

...
                                                                                                             } //<179>
                                                                                                               //<180>
//</7.6. Strategy Logic >--------------------------------------------------------------------------------------//<181>

...
 
 

 


Thankyou all, i will let you know how i get on.

Reason: