Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.
From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.
Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
Elite Section
Get access to private discussions, specialized support, indicators and trading systems reported every week.
Advanced Elite Section
For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
:: the only way to close is NOT to use " == " in your code, instead everything have to close higher or lower then your price, use... higher " >= " price or lower " <= " price, yes price doesn't go like 1 2 3, it can jump from 1 to 5 in volatile market (like big news announcements), hope this helps a little
Quote:
Originally Posted by Ronald Raygun
Hello everyone.
I'm trying to code in an effective and reliable invisible stoploss, trailing stop and takeprofit into my EAs. So far, my code just looks for the bid/ask to equal the stoploss or takeprofit value. If the price equals that value, then close the trade.
The problem I'm having is that sometimes the price seems to skip. There is no progressive movement of price. How do I then get around that problem? and make an invisible TP/SL which is guaranteed to close the trade where necessary?
luxinterior and ajk,
Thanks. I tried one of those methods before (I will have to find what I did) and it worked great for price but not for an indicator.
Have you successfully done it?
The indicator doesn't matter, if could be any of MT4's built-ins.
I want to grab the highest and lowest values of an indicator over an entire chart. A while ago I tried what I thought should have worked, from within an EA, but it didn't.
(Sorry I don't have that attempt now to show you.)
Any ideas?
Big Be
using the iHighest function:
int iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
set the count to "Bars" so.
iHighest(NULL, 0, 3, Bars, 0);
At least that what I think would work. Just check in your chart settings how many bars you keep in history. Default I think is 52,000 bars.
:: iBarShift will find for you the bar that start on that day/hour... or also the end bar for that day:hour... (depends what timeframe or chart you want to start to find your high/low).
int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
next...
:: use those bar positions to find the results of iHighest and iLowest
int iHighest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
int iLowest( string symbol, int timeframe, int type, int count=WHOLE_ARRAY, int start=0)
I'm looking to find a way to refresh a repaint indicator for every x minutes.
The only way to refresh it currently, is to click in the indicator on the chart and then click "ok". Can we automate it with MQL4 code?
I found something on codersguru's site, Programmatically Refresh your charts | www.metatrader.info, but it seems not working for me. Or is there anybody has try it and get different result (working)?
Thank you
__________________ Need a professional MQL4 programmer? PM me
Automated 2008.01.15 18:54 You could execute your code at the very first tick of a new bar ( i.e. right after the previous bar has closed ).
Here's a function that will return TRUE if a new bar has just formed:
// This function returns TRUE at the very first tick a bar i.e. after the previous bar has just closed
bool NewBar()
{
if(PreviousBarTime<Time[0])
{
PreviousBarTime = Time[0];
return(true);
}
return(false); // in case if - else statement is not executed
} you need to declare datetime PreviousBarTime at the beginning of your EA...
then in your code you could just use
if ( NewBar() )
{
...... code you need to be executed after a bar has closed here ....
} thank you automatedfx@gmail.com