You could use
double delta = OrderClosePrice()-OrderOpenPrice() pips = delta / pips2dbl;but I'd use:
int init(){ if (Digits % 2 == 1){ // DE30=1/JPY=3/EURUSD=5 https://www.mql5.com/en/forum/135345 pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl //---- These are adjusted for 5 digit brokers. /* On ECN brokers you must open first and THEN set stops int ticket = OrderSend(..., 0,0,...) if (ticket < 0) Alert("OrderSend failed: ", GetLastError()); else if (!OrderSelect(ticket, SELECT_BY_TICKET)) Alert("OrderSelect failed: ", GetLastError()); else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0) Alert("OrderModify failed: ", GetLastError()); */ : } double PipValuePerLot(string pair=""){ return(DeltaValuePerLot(pair)*pips2dbl);} double DeltaValuePerLot(string pair=""){ /* Value in account currency of a Point of Symbol. * In tester I had a sale: open=1.35883 close=1.35736 (0.0147) * gain$=97.32/6.62 lots/147 points=$0.10/point or $1.00/pip. * IBFX demo/mini EURUSD TICKVALUE=0.1 MAXLOT=50 LOTSIZE=10,000 * IBFX demo/standard EURUSD TICKVALUE=1.0 MAXLOT=50 LOTSIZE=100,000 * $1.00/point or $10.0/pip. * * https://www.mql5.com/en/forum/127584 CB: MODE_TICKSIZE will usually return the * same value as MODE_POINT (or Point for the current symbol), however, an * example of where to use MODE_TICKSIZE would be as part of a ratio with * MODE_TICKVALUE when performing money management calculations which need * to take account of the pair and the account currency. The reason I use * this ratio is that although TV and TS may constantly be returned as * something like 7.00 and 0.0001 respectively, I've seen this * (intermittently) change to 14.00 and 0.0002 respectively (just example * tick values to illustrate). * https://www.mql5.com/en/forum/135345 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(); return( MarketInfo(pair, MODE_TICKVALUE) / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point. } : double deltaPerLot = DeltaValuePerLot(chart.symbol), perPipPerLot = deltaPerLot * pips2dbl, for(){ double profit = OrderProfit() + OrderSwap() + OrderCommission(); pips = profit / OrderLots() / perPipPerLot; :
WHRoeder:
You could use but I'd use:
You could use but I'd use:
WOW!
Thank you.
This is going to take me some time to through it and understand it
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Is there a way to extract the total pip sum of a pair from history?
Greeting,
Thought I would be able to come up with this code myself, but I am not a programmer and I am way over my head. I need allot of help.
Objective:
Within the same trading hour if the total amount of pips on closed trade for a pair are greater than 10; if = false it will keep on trading; if = true will not open new trade.
Example:
All closed trade at 08 hour for Symbol…. (BUY 2pip, -2pip, 8pip and SELL-4pip total =4pip) keep on trading
All closed trade at 09 hour for Symbol…. (BUY -2pip, 8pip and SELL 6pip total =12pip) Stop trading
I was looking to add a TRUE/FALSE to the EI.
bool KeepTrading
…..
…..
//under trading
if (!KeepTrading) return(0);
{
.
}
--------------- What I have so far ---------------