Is it possible?!

 
Hi, there! I am using offline chart updated every tick with indicator. My question is is it possible to attach script to that chart and automatically trade, since EA can not be used with offline generated chart even updated every tick. FX
 

Couldn't you just put an order-send in a script and see if it worked? You could get the answer much faster that way then hoping someone else have already tried it and would be responding to your post within 15 minutes.

Update: Yeah it works.

 
ubzen:

Couldn't you just put an order-send in a script and see if it worked? You could get the answer much faster that way then hoping someone else have already tried it and would be responding to your post within 15 minutes.

Update: Yeah it works.


Thanks. I asked, because script must looping continuously as Expert Advisor, not just execute once and stoping...?
 
FX_Theory:
Hi, there! I am using offline chart updated every tick with indicator. My question is is it possible to attach script to that chart and automatically trade, since EA can not be used with offline generated chart even updated every tick. FX

The offline chart generator sends the chart update signal. You see the chart changing don't you?

EA certainly can be used then. It just can't use Period() or Symbol() from the offline chart.

What makes you think otherwise?

 

Still works.

void start(){
    bool Complete=false;
    int Cycle=TimeCurrent(); Print(TimeToStr(Cycle)+"__StartTime");
    while(true){
        if(TimeCurrent()>Cycle+60 && !Complete){
            RefreshRates();
            Cycle=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"Test",0,0,White);
            if(Cycle>0){
                Complete=true;
                Print(TimeToStr(TimeCurrent())+"__OrderSent");
            }
            Cycle=TimeCurrent();
        }
        Print(TimeToStr(TimeCurrent())+"__Sleep4Ten");
        Sleep(10000);
    }
}
09:35:20 Helping EURUSD,M5: 2011.10.21 15:32__StartTime
09:35:20 Helping EURUSD,M5: 2011.10.21 15:32__Sleep4Ten
09:35:40 Helping EURUSD,M5: 2011.10.21 15:32__Sleep4Ten
09:36:02 Helping EURUSD,M5: 2011.10.21 15:32__Sleep4Ten
09:36:02 Helping EURUSD,M5: 2011.10.21 15:33__Sleep4Ten
09:36:13 Helping EURUSD,M5: 2011.10.21 15:33__Sleep4Ten
09:36:23 Helping EURUSD,M5: 2011.10.21 15:33__Sleep4Ten
09:36:34 Helping EURUSD,M5: open #36597904 buy 0.10 EURUSD at 1.3854 ok
09:36:34 Helping EURUSD,M5: 2011.10.21 15:33__OrderSent
09:36:34 Helping EURUSD,M5: 2011.10.21 15:33__Sleep4Ten
09:36:47 Helping EURUSD,M5: 2011.10.21 15:33__Sleep4Ten
09:37:09 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:09 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:19 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:30 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:40 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:40 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:40 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:40 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:40 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
09:37:42 Helping EURUSD,M5: 2011.10.21 15:34__Sleep4Ten
 
Thank you. Actually I need to use Close[1]...or Close[i] within calculation of script/or EA ?
 
ubzen:

Still works.


ubzen: not regular chart M5, but for example M3?!
 
Compile the script I wrote, try it and let me know.
 
ubzen:
Compile the script I wrote, try it and let me know.

on M1 works, on M3 no...
 

The answer is No then.

Added: You could try putting the Trade logic in the Indicator and Setting a Terminal Global Variable to 1 for a Buy or -1 for a Sell. Have an EA or Script on normal chart read the Terminal Variable and do the trading.

 

That was my question about. Is it possible to avoid all this +++++ code, and just use script to trade instead of Expert Advisor.

Now I am on start again. Someone frome Metaquotes maybe if this is not stupid question for them may answer???!!!

Reason: