| 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 |
|
|||
|
Quote:
|
|
|||
|
Just for information:
- thread about email function (how to code) Email - good article with some tool Collaboration Dolly + Isakas + Nina System |
|
||||
|
Code for Invisible TP and SL from Brokers
Hello Everyone,
With the paranoia of brokers hunting for SLs and widening spreads to avoid TPs, I'm looking for info on how to hide TP and SL from brokers. I know that by submitting a TP and SL to the broker, in the event you're disconnected your order is "safe". While holding the info remotely, there is a danger of huge losses in the event the connection is lost. Does anyone have an EA or example of code on how to keep TP and SL hidden from the broker? Thanks! Mike
__________________
-------------------------------------------------- "Treat people as if they were what they ought to be and help them become what they are capable of being." Goethe |
|
|||
|
Help for simplify a piece of code
Hi there!
I am not a pro coder (see below!). This code work fine but is it possible to simplify it? With a while/for cycle for example? I wish the lightest code! This one is very "heavy" and I get the "internal stack overflow-simplify the program, please" error!!! It's an indicator in a separate window. In the example code, it displays the up or down for MA for multi TF. Thanks for your help. Code:
int start()
{
string MAfast_Trend_1, MAfast_Trend_5, MAfast_Trend_15;
double x;
color color_indic;
// period M1
double FastMA_1_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,MAShift);
double FastMA_2_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);
if ((FastMA_1_1 > FastMA_2_1)) { MAfast_Trend_1 = "UP"; x = 256; color_indic = Lime; }
if ((FastMA_1_1 < FastMA_2_1)) { MAfast_Trend_1 = "DOWN"; x = 246; color_indic = Red; }
ObjectCreate("Trend_MAfast_1", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);
ObjectSetText("Trend_MAfast_1",MAfast_Trend_1,7, "Verdana", color_indic);
ObjectSet("Trend_MAfast_1", OBJPROP_CORNER, 0);
ObjectSet("Trend_MAfast_1", OBJPROP_XDISTANCE, x);
ObjectSet("Trend_MAfast_1", OBJPROP_YDISTANCE, 22);
// period M5
double FastMA_1_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,MAShift);
double FastMA_2_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);
if ((FastMA_1_5 > FastMA_2_5)) { MAfast_Trend_5 = "UP"; x = 256; color_indic = Lime; }
if ((FastMA_1_5 < FastMA_2_5)) { MAfast_Trend_5 = "DOWN"; x = 246; color_indic = Red; }
ObjectCreate("Trend_MAfast_5", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);
ObjectSetText("Trend_MAfast_5",MAfast_Trend_5,7, "Verdana", color_indic);
ObjectSet("Trend_MAfast_5", OBJPROP_CORNER, 0);
ObjectSet("Trend_MAfast_5", OBJPROP_XDISTANCE, x);
ObjectSet("Trend_MAfast_5", OBJPROP_YDISTANCE, 37);
// period M15
double FastMA_1_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,MAShift);
double FastMA_2_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,MAShift+1);
if ((FastMA_1_15 > FastMA_2_15)) { MAfast_Trend_15 = "UP"; x = 256; color_indic = Lime; }
if ((FastMA_1_15 < FastMA_2_15)) { MAfast_Trend_15 = "DOWN"; x = 246; color_indic = Red; }
ObjectCreate("Trend_MAfast_15", OBJ_LABEL, WindowFind("xxxxxxx"), 0, 0);
ObjectSetText("Trend_MAfast_15",MAfast_Trend_15,7, "Verdana", color_indic);
ObjectSet("Trend_MAfast_15", OBJPROP_CORNER, 0);
ObjectSet("Trend_MAfast_15", OBJPROP_XDISTANCE, x);
ObjectSet("Trend_MAfast_15", OBJPROP_YDISTANCE, 52);
etc ...............
return(0);
}
|
|
|||
|
Code Help? One Trade Only per Candle
I am trying to restrict my ea to taking one trade only per candle. I am finding that in price spikes against the trend I am getting multiple losing trades as the indicators are lagging.
I have seen the code before but I cant find it. If anyone could point me to an ea which has the correct code or show me how it is done. It is done in the UniversalMa ea but it is not that clear to me there. Any help would be appreciated. |
|
|||
|
It is here Basic questions ...
I am collecting all the functions on this thread http://www.forex-tsd.com/general-dis...ing-forum.html |
|
||||
|
Here's a few ways to simplify your code:
REPLACE INDIVIDUAL INDICATOR VALUES WITH FUNCTION double FastMA_1_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice ,MAShift); double FastMA_1_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPric e,MAShift); .... turn into this with an added function maVal(5,1); maVal(15,1); THE FUNCTION THEY ARE CALLING IS BELOW: double maVal(int tf, int shift) { return ( iMA(NULL,tf,FastMAPeriod,0,MAMethod,MAPrice,shift) ); } * * * * * * * * * * * * * * * * * * * * * * * * Also replace other individual variables that you have like the string variables with a string array. Arrays will work very nicely in loops and will simplify your code because you have fewer declarations to make. string MAfast_Trend_1, MAfast_Trend_5, MAfast_Trend_15; .... becomes this..... string MAfast_Trend [3];
__________________
"Don't work harder, work smarter." -- my Java professor Coder for Hire: http://www.firecell-fx.com |
![]() |
| Bookmarks |
| Tags |
| candle time, CHinGsMAroonCLK, coders guru, expert advisor, forex, how to code, I_XO_A_H, mechanical trading, trading |
| 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 07: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 05:22 PM |