示例#1
0
 //Public Methods
 public BasicStyler(int canvas_length, float margin, MarginMode margin_mode, string json_path)
     : base(canvas_length, margin, margin_mode, json_path)
 {
     //init colors
     black_color      = Default.BLACK;
     white_color      = Default.WHITE;
     background_color = Default.BG_COLOR;
     canvas_color     = Default.CANVAS_COLOR;
 }
示例#2
0
 public SymbolRecord(JSONObject body)
 {
     this.Ask            = (double)body["ask"];
     this.Bid            = (double)body["bid"];
     this.CategoryName   = (string)body["categoryName"];
     this.Currency       = (string)body["currency"];
     this.CurrencyPair   = (bool)body["currencyPair"];
     this.CurrencyProfit = (string)body["currencyProfit"];
     this.Description    = (string)body["description"];
     this.GroupName      = (string)body["groupName"];
     this.High           = (double)body["high"];
     this.Leverage       = (double)body["leverage"];
     this.LotMax         = (double)body["lotMax"];
     this.LotMin         = (double)body["lotMin"];
     this.LotStep        = (double)body["lotStep"];
     this.Low            = (double)body["low"];
     this.Precision      = (int)body["precision"];
     this.ContractSize   = (int)body["contractSize"];
     this.MarginMode     = MarginMode.FromCode((int)body["marginMode"]);
     this.Percentage     = (double)body["percentage"];
     this.ProfitMode     = ProfitMode.FromCode((int)body["profitMode"]);
     this.QuoteId        = (int)body["quoteId"];
     this.SpreadRaw      = (double)body["spreadRaw"];
     this.SpreadTable    = (double)body["spreadTable"];
     this.StopsLevel     = (int)body["stopsLevel"];
     this.SwapEnable     = (bool)body["swapEnable"];
     this.SwapLong       = (double)body["swapLong"];
     this.SwapShort      = (double)body["swapShort"];
     this.SwapType       = (int)body["swapType"];
     this.Symbol         = (string)body["symbol"];
     this.TickSize       = (double?)body["tickSize"];
     this.TickValue      = (double?)body["tickValue"];
     this.Time           = (long)body["time"];
     this.TimeString     = (string)body["timeString"];
     this.Type           = (int)body["type"];
 }
示例#3
0
 public BlockStyler(int canvas_length, float margin, MarginMode margin_mode, string json_path)
     : base(canvas_length, margin, margin_mode, json_path)
 {
 }
示例#4
0
 //Construction
 public BlockStyler(int canvas_length, float margin, MarginMode margin_mode) : base(canvas_length, margin, margin_mode)
 {
     InitDefaultPatterns();
 }
示例#5
0
        //construction
        public TetrisStyler(int canvas_length, float margin, MarginMode margin_mode, string json_path) : base()
        {
            InitJson(json_path);
            TopGridRowNumber    = (int)(JsonInstance.Size * 0.408);
            BottomGridRowNumber = (int)(JsonInstance.Size * 0.216);
            int   canvas_width = canvas_length;
            int   canvas_height;
            float code_length;
            float margin_length;
            float step_length;

            //calculate canvas_height
            if (margin_mode == MarginMode.PIXEL)
            {
                margin_length = margin;
                code_length   = (float)(canvas_width - margin * 2);
                step_length   = code_length / (float)JsonInstance.Size;
                canvas_height = (int)((TopGridRowNumber + BottomGridRowNumber + JsonInstance.Size) * step_length + margin * 2);
            }
            else
            {
                step_length   = (float)canvas_width / (float)(JsonInstance.Size + margin * 2);
                margin_length = margin * step_length;
                code_length   = step_length * JsonInstance.Size;
                canvas_height = (int)((TopGridRowNumber + BottomGridRowNumber + JsonInstance.Size + margin * 2) * step_length);
            }
            //top margin & bottom margin
            float margin_top    = margin_length + step_length * TopGridRowNumber;
            float margin_bottom = margin_length + step_length * BottomGridRowNumber;

            //Initialation
            __InitStyleWithMarginMode(canvas_width, canvas_height, margin_length, margin_top, margin_length, margin_bottom, MarginMode.PIXEL, JsonInstance.Matrix, JsonInstance.Size);
            //set ToPosition and BottomPosition
            float step_height = (float)CodeSize.Height / (float)Matrix.MatrixOrder;
            float top_x       = CodePosition.X;
            float top_y       = CodePosition.Y - (step_height * TopGridRowNumber);

            TopPosintion = new PointF(top_x, top_y);

            float step_width = (float)CodeSize.Width / (float)Matrix.MatrixOrder;
            float bottom_x   = CodePosition.X;
            float bottom_y   = CodePosition.Y + CodeSize.Height;

            BottomPosition = new PointF(bottom_x, bottom_y);

            //set TopSize and BottomSize
            float top_width  = CodeSize.Width;
            float top_height = step_height * TopGridRowNumber;

            TopSize = new SizeF(top_width, top_height);

            float bottom_width  = CodeSize.Width;
            float bottom_height = step_height * BottomGridRowNumber;

            BottomSize = new SizeF(bottom_width, bottom_height);

            //set TetrisStep
            TetrisStep = IntStep.Width;

            //set TopCanvas and BottomCanvas
            TopCanvas    = new Bitmap(TetrisStep * Matrix.MatrixOrder, TetrisStep * TopGridRowNumber);
            BottomCanvas = new Bitmap(TetrisStep * Matrix.MatrixOrder, TetrisStep * BottomGridRowNumber);

            //init top and bottom matrixs
            InitTopMatrix(TopGridRowNumber, Matrix.MatrixOrder);
            InitBottomMatrix(BottomGridRowNumber, Matrix.MatrixOrder);
        }
示例#6
0
 //construction
 public BarStyler(int canvas_length, float margin, MarginMode margin_mode) : base(canvas_length, margin, margin_mode)
 {
     initBarStyler();
 }