//+------------------------------------------------------------------+ //| MTF backtester | //+------------------------------------------------------------------+ #property copyright "Pavol Finka" #property link "" #property show_confirm //+-----------------------------------------------------------------------+ //| script vytvorí VL, ktorou hýbete posúvaním VL v okne so scriptom GET | //+-----------------------------------------------------------------------+ bool useFile = false; int start() { datetime actual_position; while (true) { actual_position = 0; if (useFile) actual_position = ReadFromFile (); else if(GlobalVariableCheck("BackTest_VL")) actual_position = GlobalVariableGet("BackTest_VL"); if (actual_position != 0) CreateVLine("BT", actual_position, STYLE_SOLID, 1, Blue , ""); WindowRedraw(); Sleep (100); } return(0); } //+------------------------------------------------------------------+ void CreateVLine(string name, datetime t1, int style, int width, color col, string description) { ObjectDelete(name); ObjectCreate(name, OBJ_VLINE, 0, t1, 0); ObjectSet(name, OBJPROP_COLOR , col); ObjectSet(name, OBJPROP_STYLE , style); ObjectSet(name, OBJPROP_WIDTH , width); ObjectSetText(name, description, 8); } datetime ReadFromFile () { string filename = "sorrex_backtest.csv"; datetime actual_position = 0; int fileHandler; fileHandler=FileOpen(filename,FILE_CSV|FILE_READ); if(fileHandler<1) { Print("File not found, the last error is ", GetLastError()); return; } actual_position = StrToTime(FileReadString(fileHandler)); Comment (TimeToStr(actual_position,TIME_DATE|TIME_SECONDS)); FileClose(fileHandler); return (actual_position); }