Where do you get that, I mean the link or something.
That code is not even complete :(
Where do you get that, I mean the link or something.
That code is not even complete :(
On a previous posting deVries provided a linc to this.
If you have any suggestions to getting last executed TP level
I would aprieciate it.
On a previous posting deVries provided a linc to this.
If you have any suggestions to getting last executed TP level
I would aprieciate it.
My apology, can not help. That's should be an 'include', but for what, I have no idea. You just have to wait for DeVries or WHRoeder then :(
I do not have to use this bit of code. There is no restriction Im just trying to get some help.
Thanks.
That code snippet was not posted to be copy pasted as a complete function into an EA, it was posted that you might learn from it how to create your own code.
As i look at the code there isnt a look at the last executed TP price. How do I code a look at that price.
OrderHistoryTotal Ok,the last close how do I select TP close price.
Thanks.
As i look at the code there isnt a look at the last executed TP price. How do I code a look at that price.
OrderHistoryTotal Ok,the last close how do I select TP close price.
Thanks.
Was your coding to find at "need to store last profit taken" looking at
OrdersHistoryTotal( ) and then selecting the trades to get the trade needed ?
This is an example to look at it for getting an idea not a complete solution to write this way in your code
Have you ever looked to the code of the standard moving average EA
Inside of it you can find this
//+------------------------------------------------------------------+ //| Calculate optimal lot size | //+------------------------------------------------------------------+ double LotsOptimized() { double lot=Lots; int orders=HistoryTotal(); // history orders total int losses=0; // number of losses orders without a break //---- select lot size lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1); //---- calcuulate number of losses orders without a break if(DecreaseFactor>0) { for(int i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; //---- if(OrderProfit()>0) break; if(OrderProfit()<0) losses++; } if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1); } //---- return lot size if(lot<0.1) lot=0.1; return(lot); } //+------------------------------------------------------------------+ //| Check for open order conditions | //+------------------------------------------------------------------+
it is to calculate the lotsize after a loss the lotsize is decreased
maybe this is a better start for you...
but this is not checking magicnumber...
ofcours if you can not compile then there are errormessages to look at
all your closed trades are in OrdersHistoryTotal()
then select the trades till you have what you want
Was your coding to find at "need to store last profit taken" looking at
OrdersHistoryTotal( ) and then selecting the trades to get the trade needed ?
This is an example to look at it for getting an idea not a complete solution to write this way in your code
Have you ever looked to the code of the standard moving average EA
Inside of it you can find this
it is to calculate the lotsize after a loss the lotsize is decreased
maybe this is a better start for you...
but this is not checking magicnumber...
ofcours if you can not compile then there are errormessages to look at
all your closed trades are in OrdersHistoryTotal()
then select the trades till you have what you want
Im sorry there is a miss communication, What im trying to do is to store or access the closed price of the last TP execution.
Example TP executed at 1.4356
There are several reasons for closing a trade. Only the TP closing price Im looking for.
Thank your for any help.
Im sorry there is a miss communication, What im trying to do is to store or access the closed price of the last TP execution.
Example TP executed at 1.4356
There are several reasons for closing a trade. Only the TP closing price Im looking for.
Thank your for any help.
then you have to check if the trade is closed at OrderTakeProfit() ofcours in historytotal
with other words OrderClosePrice()in OrderHistory has to be the same as OrderTakeProfit() then the trade is closed at takeprofit
then you have to check if the trade is closed at OrderTakeProfit() ofcours in historytotal
with other words OrderClosePrice()in OrderHistory has to be the same as OrderTakeProfit() then the trade is closed at takeprofit
Ok lets see
if (OrderHistoryTotal(1))
if ( OrderClosePrice(1) == OrderTakeProfit(1) )
Im only opening one trade at a time.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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, a bit of WHReoder program was suggested to me,I cant get it to compile.
I am trying to get the last profit taken (order price level ) to use for continuation of
trend for intri level.