You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Coding "Trend Condition" with StepMA
forgotten: for my previous posting the indicator and a screenshot
Thanks Much Devil2000!
From the metaeditor:
Now can you tell me where to place this code?
I'm a real rookie at this stuff.
This is what shows up in Meta Editor:
extern double lot=0.01;
extern int MinGS=10;
extern double TP=10;
extern double MarginLevelAlert=1000;
extern double RepeatMinutes=60;
double MaxDrawDown = 0.0;
int magic;
int Account = 1857842;
double lot2;
double MarginPer;
datetime tob,tos,toe; //Time Out Buy, Sell, Expire
Appreciate the help.
Cheers
MaOnArray
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:
MaOnArray
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.
Good hunting!
Big Be
Two Stops Question
See later post.
Two Stops Question
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
OK, thanks Big Me,
I'll post the whole EA tommorow. So U can be able to take a look at it.
regards,
J
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 BeWouldn'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.
Symbol in broker
hi all
i need to obtain all symbols in MetaTrade... How to code?
regards
charles
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.
Simpler, but less profitable for me. My EA rides a trend and I want both halves to have the chance to go all the way. Do you know how?
Big Be