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.
Can someone help me with the code of the "Trend Condition" in the above example, it does not work. I tried to call the buffer 1 and buffer 2 for long and short mode but I don't understand the code of this indicator. Thank you in advance!
Hi,
it would like to go long if the CCI goes above it's 14 sma, and go short when it goes below it's 14 sma. The CCI's sma is generated by the MaOnArray of the CCI of course.
This is my piece of code:
double a,b;
bla, bla, bla...
int start()
{
a= iCCI(NULL, 0, 14,PRICE_WEIGHTED,0);
b=iMAOnArray(a,0,14,0,MODE_SMA,0);
// check for long position (BUY) possibility
if(NewBar1()==true && a>b)
{
bla, bla, bla...
// check for short position (SELL) possibility
if(NewBar2()==true && a<b)
{
bla, bla, bla...
There is a problem however (it's pictured below) - so is there something that's missing in the code? and how can this problem be solved?
Problem is below:
Jane,
First, you need to control how many trades open.
I suggest adding
if (OrdersTotal()==0) {
before entry filters, or maybe <= 1, for 2 orders allowed.
Or if you want more than two trades at a time:
for (int i = OrdersTotal() - 1; i >= 0;i--)
(Study most EAs for this one.)
I don't think you have given enough data for one to solve it, but I have a couple more suggestions.
It is not clear what NewBar1() does and how.
Make sure your global variables are re-set as needed after an order is opened (or closed, if applicable).
I write a line for each necessary variable after the open order line.
I need to know how to change the Stop for HALF of my open order. My understanding is that this means opening two orders, for example .2 lots and .2 lots.
My EA bases the number of lots on a Money Management calculation.
After the stop for one order is changed (based on a price level being reached) then I would let my exit code close both orders, unless their (now different) stops are hit.
The other order retains its original stop or possibly moves it up to Break Even.
If the initial quantity of lots (from the MM function) Is odd, instead of rounding down for an odd number of lots or tenth lots, I would like to split them unevenly between the two orders.
I believe this involves Magic Numbers, and a couple lines of code here and there. Maybe there is an EA with all this that I could copy from.
I need to know how to change the Stop for HALF of my open order. My understanding is that this means opening two orders, for example .2 lots and .2 lots.
My EA bases the number of lots on a Money Management calculation.
After the stop for one order is changed (based on a price level being reached) then I would let my exit code close both orders, unless their (now different) stops are hit.
The other order retains its original stop or possibly moves it up to Break Even.
If the initial quantity of lots (from the MM function) Is odd, instead of rounding down for an odd number of lots or tenth lots, I would like to split them unevenly between the two orders.
I believe this involves Magic Numbers, and a couple lines of code here and there. Maybe there is an EA with all this that I could copy from.
Thanks for any help.
Big Be
Wouldn't it be a whole lot simpler to just open 1 order and scale out of that, adjusting a 'soft' SL on the remainder. You could place a Doomsday hard-stop just in case. Not only is it far easier, you are also not giving the bucketshops something to 'aim' at.