Coding help - page 752

 
Empower:

i try it, but i have problem in candle deviding.

for example when i set indicator time to 240 it locked on 240 and when i change chart  timefame it's not changed with chart timeframe and show only 240 indicator settings and not devid candle with chart time frame.

in below charts you can see that histogram (indicator set to 240) is the same for all chart time frame

i changed this indicator to mtf but it not work true

i sent it please help me how can i solve this problem

You can not use the shift of the current time frame bar for higher time frame too

Use iBarShift(NULL,TimeFrame,Time[current]) instead of using current in the code

 
Mladen, 
If you had some time, would you please check my post #7503 and #7504 in this thread? Could you please fix what is wrong in my code attempt?


 

Hi Mladen,

I wondered if you could help me on a problem I have with my EA.

It is working and everything, but the problem is the entry. It is set to take a trade (when conditions are met) on the open of a new bar. Now, since I'm trading binary options with this EA, I need it to take the entry at the precise beginning of the minute (I'm on a 1M chart, which means :00). 

Now, if the broker's price doesn't move, MT4 doesn't receive any ticks and doesn't create a new candle until it does receive something, as you know. 

What are the solutions to take a trade at :00?  

Thanks for your help.  

 
Jason2005:

Hi Mladen,

I wondered if you could help me on a problem I have with my EA.

It is working and everything, but the problem is the entry. It is set to take a trade (when conditions are met) on the open of a new bar. Now, since I'm trading binary options with this EA, I need it to take the entry at the precise beginning of the minute (I'm on a 1M chart, which means :00). 

Now, if the broker's price doesn't move, MT4 doesn't receive any ticks and doesn't create a new candle until it does receive something, as you know. 

What are the solutions to take a trade at :00?  

Thanks for your help.  

Try using OnTimer() event but not even that will guarantee you that the code will be executed at the exact :00 time
 
mladen:
Try using OnTimer() event but not even that will guarantee you that the code will be executed at the exact :00 time
Thanks Mladen! That did it ;) 
 
investguy:

So im writing a EA that will make use of live trade history during optimization and i thought of writing the results to a csv when running and read during optimization.

Option #1: Read the csv during init and write to array?

Option #2: Read from a database(sql, etc..)

Taking into consideration speed..

 

Is there an easier way ?

  

Best Regards

What live history are you talking about?

If you mean the live trading history, then use csv (assuming that you are not going to have 1000s of live orders that would not hurt the performance of the EA while tested). But wouldn't it be curve fitting to the history?

==========

I plan on using the live trading history during optimization and don't believe it will become curve fitting. Am i wrong? My objective is to adapt the EA trading settings to current market conditions adding open trades from live trading history..  I will be looking(order open time) for currently open trades and placing the trade signal as the optimization goes. 

 

Is there a better way to do that during optimization other than using a csv??  

 

Hello.

I got a question. I have a Button in the MT4 Chart.

Button (green) -> pushing the Button  -> Button now red + in an extern File (file.csv) will be written a 0
Button (red) -> pushing the Button  -> Button now green + in an extern File (file.csv) will be written a 1

An Indicator is reading the 0 or 1 in file.csv file and changing CHART_BRING_TO_TOP on/off. Works!

BUT, the Buttoncolor (green/red) is only changing in the chart in that I pushed the Button.
Is it possible to change it in all open charts!?

Example

  • EURUSD: green -> pushing to red (chart switch deactivate)
  • AUDUSD: green (stays green, but chart switch is deactivated and should also switch to red)
  • USDJPY: green (stays green, but chart switch is deactivated and should also switch to red)
  • GBPUSD: green (stays green, but chart switch is deactivated and should also switch to red)
Best regrads, oink!
 
oink:

Hello.

I got a question. I have a Button in the MT4 Chart.

Button (green) -> pushing the Button  -> Button now red + in an extern File (file.csv) will be written a 0
Button (red) -> pushing the Button  -> Button now green + in an extern File (file.csv) will be written a 1

An Indicator is reading the 0 or 1 in file.csv file and changing CHART_BRING_TO_TOP on/off. Works!

BUT, the Buttoncolor (green/red) is only changing in the chart in that I pushed the Button.
Is it possible to change it in all open charts!?

Example

  • EURUSD: green -> pushing to red (chart switch deactivate)
  • AUDUSD: green (stays green, but chart switch is deactivated and should also switch to red)
  • USDJPY: green (stays green, but chart switch is deactivated and should also switch to red)
  • GBPUSD: green (stays green, but chart switch is deactivated and should also switch to red)
Best regrads, oink!
Loop through all the open charts and look for object on all open charts with that same name
 

Hello.

Can´t get it... :-( 

Best regards, oink! 

Files:
 
oink:

Hello.

Can´t get it... :-( 

Best regards, oink! 

Where exactly in your code did you try to loop through all charts (using ChartFirst(), ChartNext() and the rest of the functions that are designed to work with any chart of the terminal)?
Reason: