Alain Verleyen:
What is the value of DCA ?
This function doesn't return a value, what is always returning 0 ? DTB and DTS ?
:)
I solved the problem already. Working through history is slightly difficult.
Dua Yong Rew:
So, can't you share your solution when you are expecting help from the community ?
:)
I solved the problem already. Working through history is slightly difficult.
Alain Verleyen:
So, can't you share your solution when you are expecting help from the community ?
So, can't you share your solution when you are expecting help from the community ?
alright, here goes.
The code is to check last few close trades. if there are consecutive losing buys or sells, what should your system be heading for???
//+------------------------------------------------------------------+ //| Last Chain Actions | //+------------------------------------------------------------------+ void LastChainActions() { //--- long EntryType; ulong Ticket; string DealSym; HistorySelect(0, TimeCurrent()); for(int i = HistoryDealsTotal() - 1; i >= 0; i--) { Ticket = HistoryDealGetTicket(i); DealSym = HistoryDealGetString(Ticket, DEAL_SYMBOL); EntryType = HistoryDealGetInteger(Ticket, DEAL_ENTRY); if(DealSym == _Symbol && EntryType == DEAL_ENTRY_OUT) { if(HistoryDealGetInteger(Ticket, DEAL_TYPE) == DEAL_TYPE_BUY) { if(HistoryDealGetDouble(Ticket, DEAL_PROFIT) < 0.0) { if(DTS > 0) break; DTB += 1; } } if(HistoryDealGetInteger(Ticket, DEAL_TYPE) == DEAL_TYPE_SELL) { if(HistoryDealGetDouble(Ticket, DEAL_PROFIT) < 0.0) { if(DTB > 0) break; DTS += 1; } } } if(DTB == DCA || DTS == DCA) break; } //--- }
DCA is a input
Dua Yong Rew:
Thanks for sharing.
alright, here goes.
The code is to check last few close trades. if there are consecutive losing buys or sells, what should your system be heading for???
DCA is a input
Alain Verleyen:
Thanks for sharing.
no problem :)
Thanks for sharing.

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
I'm trying to count my last few deal losing action with this code. It is returning 0 always.
Is there anything wrong with the code?
DTB and DTS are global variable.