Download MetaTrader 5

last deal profit/loss

To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
AndreaG
18
AndreaG 2015.12.31 07:57 

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

Marco vd Heijden
Moderator
4704
Marco vd Heijden 2015.12.31 10:22  
AndreaG:

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

MODE_HISTORY
Doerk Hilger
1155
Doerk Hilger 2016.01.01 11:14  

First you need to define what a "deal" is. A deal it not a position, a trade is not a position as well.

A trade starts with the opening of a position and it ends when the last position was closed. All positions in between are part of the trade/deal. I have no idea what you want to code, but sou should keep this in mind if you want to achieve good results. MODE_HISTORY ... i tried to work with that too, but I could not figure out which history data it´s actually providing and how long history data is saved. 

Alain Verleyen
Moderator
30743
Alain Verleyen 2016.01.01 20:54  
AndreaG:

hi,

 

I'm writing a neural network and need it to know if the last operation was successful.

something like 

  if [last deal generate profit] then x=0

if [last deal was at loss] then x=1

and possibly

  if [last 2 deals was at loss] then x=-1

what is the parameter can I use to find out the info I need?

 

thank you (and sorry for my english ;-) )

:-) 

Your question is about mql4 or mql5 ?
AndreaG
18
AndreaG 2016.01.04 16:04  

Mql5, sorry, I forget that detail :-)

 

I need to know si the answer to the question: "in the last trade I gain money or I lose money?"

it would be good io I can find the answer to that question even for the trade before that

Xiangdong Guo
3741
Xiangdong Guo 2016.01.04 16:57  

Check HistoryDealGetInteger in MQL5 Reference, it provides some example codes.

To add comments, please log in or register