Forum

Why doesn't OnChartEvent continue working?

I wrote an indicator that draws symbols on the chart once I draw a trendline. I wrote in the OnChartEvent function to run the code every time I drag the trendline. It works finitely many times, and then all of a sudden the symbols on the chart are frozen, no matter how many times I change the

Problem with checking margin

I'm coding an EA and I have a margin check within my EA to make sure I have enough margin to enter a trade. But for some reason I always get an insufficient margin, and I have no idea what's wrong. Here is my code: //checks if we can send the order based on margin levels. bool enoughmargin( double

Why does ObjectDescription only require one parameter?

ObjectDescription takes one input-the name of an object. What if I have multiple objects, each on different charts, with the same name? How do I distinguish them

Can magic numbers be used for more than one order?

If I have an EA that enters trades on a specific magic number , say 1000, then can I have multiple orders with the same magic number? Even if they are different order types? (buy limit, sell stop, etc) and even if its different symbols

Is there a way to record a bar using iTime?

I'm coding an EA based on price action, but I have one part where I need to record a "signal bar," (for example a pin bar or a second bar of a 2 bar reversal). So if I see such a bar, I can assign the value iTime of that bar to a global variable. Now, given the datetime of that bar, how can I find

How do I calculate values on a trendline?

Suppose I draw a trendline, and I want an indicator that can draw lines above and below it by x pips. So I first find the trendline, take its price and time values, and calculate slope, then plot the lines. However, certain instruments close early on fridays and open later on mondays, so even though

Is there an indicator to label bars?

Is there an indicator that can label bars? Like you input a value, say 100, and the last 100 bars from the current bar are labelled 1-100. It would be really helpful for analyzing past trades/past market conditions. Can someone show me how to code this? I don't have much programming experience

unkown subwindow number -1 for object create function error

I'm using an indicator called 10.2 TMA slope, and although it compiles without errors, and even works in an EA, when I backtest my EA, a whole bunch of error messages pop up in the journal saying, \ 10_2 TMA slope v1_4B 4_30 for EA EURUSD,H4: unknown subwindow number -1 for ObjectCreate function

Problem with code-wont work in an EA

Hi guys, I'm trying to code the double bottom chart pattern using fractals, and although the compiler says there are no errors, it doesnt seem to work in an EA. can you help me figure out whats wrong? bool doublebottom() { double val1,val2,v1[],v2[]; double Lows[],Highs[]; double

how to prevent multiple trades in one bar?

My EA has only up to one trade opened at any moment, but on certain bars it opens and closes mutliple trades, probably as many as the ticks in that bar. How can I prevent more than one or two trades opening in one bar