Hey All!
This is obviously not all the code, but this is the main part that I am pulling my hair out with. Please check the code with the "<<<<<<<<<<<<<". These are the points I am confused about.
Thanks RaptorUK - In the kindest way possible, that doesn't explain anything to me? In layman's terms?
Is this a forum where someone can actually help me other than repeating the definitions of functions (in which I have read 100's of times from the "help" section...)
After-all, I don't feel what I am asking (In comparison to some of the threads on here!) is enough to warrant someone to charge for their time...?
Translating to layman's terms will help you... once, today, with this particular issue.. and take some amount of time for the explainer.
If you say which ones of the definition you don't understand, maybe next time you can solve your own problems, and after a while, you can be one of the ones solving other peoples problems.
If you try and investigate the problem yourself, you will also learn a lot more. For example, try this:
Alert(iHighest(Symbol(), 0, MODE_HIGH, iBarShift(Symbol(), 0, triggerBarTime, true), 0));
and you will see what value is being returned by the function... (like Raptor says, it's not a price).. and you will probably more easily understand the definition of the function.
Things like this will help you more than hoping someone on the board has time to test out your code and do the same troubleshooting that you should be learning how to do for yourself.
Huh? I am so confused - Am I asking too much for some help?
After-all, I have built my entire EA from the ground up (which I have taught myself...) Just wanting some guidance from someone who has more knowledge than me... :s
"Things like this will help you more than hoping someone on the board has time to test out your code and do the same troubleshooting that you should be learning how to do for yourself."
What the hell... I was not expecting that from anyone!?
Your post has shed more light on the situation - Appreciate it.
This forum is really funny... I was not planning on free-loading off of anyone! I simply wanted some clarification as to how I correctly identify the bar that crosses with the EMA's...
Jeez....
when I read raptor's answer it is telling you the exact problem you have made.
prices are stored as double variables e.g. 1.12345
the iHighest functions returns an integer (int) e.g. 1 or 2 or -100 .... clearly not a price.
I don't know what you're trying to achieve but the iHighest function is probably not the one you want to be using.
You would have discovered this for yourself if in metaeditor, you click on iHighest in your code, then press F1... you will see that it returns an integer (which Raptor also told you)
I don't know the source of your confusing. If you don't know the difference between int and double variables you are missing some vital basic knowledge, meaning you are trying to run before you can walk, and you want someone else to carry you :/
EDIT: You weren't expecting that you have to do your own troubleshooting before asking someone else?!?
Multiple moving averages will not cross at the same time.
Why are you double posting? Your question was previously answered.
Find the earliest bar where they were all in the proper order.
int DIR = 0; for(int iBar = 0; iBar < Bar; iBar++){ double MA20 = ... iBar), MA5 = ... iBar); : if( MA20 > MA5 && MA5 > ...) DIR = -1; else if(MA20 < MA5 && MA5 < ...) DIR = +1; // All fanning up. else if (DIR != 0){ iBar--; break; } // Last one was cross. }
I understand the difference between int and double...
after the If statements are true, I am wanting to find the bar that crossed at the point where the MA's are spaced apart. I thought if I used:
"triggerBarTime = Time[1];" - after the "If" statements then triggerBarTime could be used in conjunction with iBarShift to lock in the first bar of the range I am interested in?
Then, using the iHighest, would allow me to convert this info into an int and use it into my order function? (Buy_Price)?
You may understand the difference between int and double but you don't understand the difference between a bar number (int) and a price (double).
iHighest would allow you to convert you datetime into a bar number (int.) But OrderSend only takes a price (a double) it makes no sense to open an order at 9
Ah! Gotch-ya!
Thank you very much :) I really do appreciate it!
Thanks for being patient with me - I didn't mean to come across in a way to expect anyone to do anything for me; just giving me some clarification on the help (pressing F1 on everything isnt always that clear to me.) is all I wanted.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey All!
I was hoping for some help on my code - Currently stuck on this one damn part!
This is the process I am attempting to write into code below:
1) If all MA's are "fanned" out and crossed so that price is above all the moving averages and they are indicating a long potential.
2) I am then wanting to know the exact bar (using Time) that the moving averages are "fanned apart" at the cross of the moving averages.
3) If 1 and 2 are true, I then wait for any bar to come back down (in the case for a long position) and touch the 21 EMA.
4) From the first Bar (where the MA's crossed and fanned out) to the bar that has now touched the 21 EMA - I want a pending order OR at the market trade placed ABOVE the highs of this range (1 & 3).
5) If price at ANY point CLOSES beneath the 60 EMA, BEFORE triggering the order - then the order is to be cancelled.
This is obviously not all the code, but this is the main part that I am pulling my hair out with. Please check the code with the "<<<<<<<<<<<<<". These are the points I am confused about.
I could REALLY do with someone' help - it would really be appreciated!
Many thanks in advance!