| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack (1) | Thread Tools | Display Modes |
|
||||
|
Hi,
look at this http://www.forex-tsd.com/4357-post6.html and http://www.forex-tsd.com/6239-post9.html. Igor
__________________
Let's improve trade skills together http://finance.groups.yahoo.com/group/TrendLaboratory |
|
|||
|
Please help with this code...
I'm trying to learn about the mechanism of the LSMA_in_color indicator, which I found elsewhere on this forum. The following code sets the color of the indicator line segments based on the values in wt[]:
Code:
//========== COLOR CODING ===========================================
ExtMapBuffer3[shift] = wt[shift]; //yellow
ExtMapBuffer2[shift] = wt[shift]; //blue
ExtMapBuffer1[shift] = wt[shift]; //red
if (wt[shift+1] > wt[shift])
{
ExtMapBuffer2[shift] = EMPTY_VALUE; //turn blue off
Print ("red ",wt[shift+1]," ",wt[shift]);
}
else if (wt[shift+1] < wt[shift])
{
ExtMapBuffer1[shift] = EMPTY_VALUE; //turn red off
Print ("blue ",wt[shift+1]," ",wt[shift]);
}
else
{
ExtMapBuffer1[shift]=EMPTY_VALUE; //turn red off;
ExtMapBuffer2[shift]=EMPTY_VALUE; //turn blue off;
Print ("yellow ",wt[shift+1]," ",wt[shift]);
}
Also, in looking at the log I see instances where wt[shift] is identical to wt[shift+1], but it prints as a red condition. How can this occur when the red condition requires that wt[shift+1] > wt[shift] ? Any help would be appreciated ![]() |
|
|||
|
code to check if last [closed] trade was a win or lose..
Is there a method in mql4 for checking whether the last trade resulted in profit or loss, after it's closed?
I'm trying OrderSelect() and OrderProfit() with the HistoryTotal() using an array.. but the OrderProfit seems to be referring to the 'open order' , so it's not giving me the results im wanting. On average, my system has 5 consecutive wins, to 1 lose. What im wanting to do is, after a losing trade, i want to increase the number of lots used as the chances are the next trade after it will be a win. I therefore need to check what the last closed trade resulted in, before modifying the number of lots. Any help would be appreciated...
__________________
fxdk |
|
||||
|
Quote:
to check the profit of the last closed order use this code: int total = HistoryTotal(); OrderSelect(total-1,SELECT_BY_POS,MODE_HISTORY); Alert(OrderProfit()); //This is the last closed order profit or loss |
|
|||
|
Quote:
|
|
||||
|
Quote:
very good idea! |
|
|||
|
Last order profit
Hi
This is what I use - works well. [CODE/]/////////// int i,orders; //Determine if the last trade was a winner or losser orders = HistoryTotal(); //Print("PP0: orders : ", orders); for(i=orders-1;i>=0;i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==fals e) { Print("Error in history!"); break; } // if((OrderSymbol()!=Symbol()) || (OrderType()>OP_SELL) || (OrderMagicNumber() != MagicNum1)) continue; //Print("PP11 Profit : ", OrderProfit()); if(OrderProfit()>0) { wl = -1; break; } if(OrderProfit()<0) { wl = 1; break; } } [\code] Last edited by cardio; 04-25-2006 at 06:41 PM. |
![]() |
| Bookmarks |
| Tags |
| CHinGsMAroonCLK, I_XO_A_H |
| Thread Tools | |
| Display Modes | |
|
|
LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/metatrader-programming/554-how-code.html
|
||||
| Posted By | For | Type | Date | |
| Need an experienced programmer? - Page 2 | Post #0 | Refback | 09-24-2008 06:24 AM | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to code this? | iscuba11 | Metatrader 4 mql 4 - Development course | 1 | 08-03-2007 04:22 PM |