Trailing Bar Entry EA

Back to topics list  | 1 2 3 To post a new topic, please log in or register
avatar
12985
WHRoeder 2013.08.19 01:33 #
 
BenLinus: What I asked for is a way to exit the caller from inside a function.

What you asked for is something to give to your CEO to get your boss (and you) fired. Doesn't work in SW.

Once you return, your 'boss' is in charge. You can't force your 'boss' to do anything.

 
avatar
80
BenLinus 2013.08.19 03:52 #
 
WHRoeder:

What you asked for is something to give to your CEO to get your boss (and you) fired. Doesn't work in SW.

Once you return, your 'boss' is in charge. You can't force your 'boss' to do anything.


Lol.

It is conceivable at least. For example, I could give the CEO spoofed evidence that we are both involved in some questionable activities.We will both be fired.



 
avatar
80
BenLinus 2013.08.19 03:59 #
 

Anyway,

I worked something out:

I replaced all occurrences of OrderSelect() in start() with

        if (!OrderSelectAlert(index, select, pool=MODE_TRADES))   //order is now selected as a side effect
                return(0);

Where, OrderSelectAlert() is defined as follows:

bool OrderSelectAlert(int index, int select, int pool=MODE_TRADES) {
        if (OrderSelect(index, select, pool))   return(true);
        else{
                if(Closing_Alert_Made) return(false);   //This is a global variable in customs.mqh initialized to 0
                //order was not made and an alert was shown. start() should skip
                Alert("Ticket was not found.");
                Closing_Alert_Made = true;
                return(false);
        }
}


I don't know if this is good design. If ever I become a better, more experienced programmer I might know.


 
avatar
15
Ratio_O 2015.08.16 21:20 #
 
double NormalizePrice(double p, string pair=""){
        // https://forum.mql4.com/43064#515262 zzuegg reports for non-currency DE30:
        // MarketInfo(chart.symbol,MODE_TICKSIZE) returns 0.5
        // MarketInfo(chart.symbol,MODE_DIGITS) return 1
        // Point = 0.1
        // Prices to open must be a multiple of ticksize 
    if (pair == "") pair = Symbol();
    double ts = MarketInfo(pair, MODE_TICKSIZE);

    return( MathRound(p/ts) * ts );
}
Added missing semicolon (red)
Back to topics list   | 1 2 3  

To add comments, please log in or register