I have written a method for close the position bool ClosePosition_real( int currentMagic, double &_profit) { MqlTradeRequest tradeRequestClose; MqlTradeResult tradeResultClose; int total= PositionsTotal (); // number of open positions for ( int i=total- 1 ;
The CopyTicks function does not copy the duplication of ticks. For example: the difference between two ticks are flags and date. In the first case, the flags are 14, and in the second case, the flags are 8. The time differs by 1000 milliseconds. Each tick is very important for my script because the
I made a purchase at a price of 0.9615 and sell it when the price was 0.9586. other parameters look like this: spread 0,0004 volume 0,2 leverage 1:100 balance 10000 I try to calculate the profit: ((open_price - close_price) - spread) * ( volume * balance * leverage ) = profit So, if we substitute
I have created a canvas DebugDraw() { _width=( ushort ) ChartGetInteger ( 0 , CHART_WIDTH_IN_PIXELS ); _height=( ushort ) ChartGetInteger ( 0 , CHART_HEIGHT_IN_PIXELS ); ccanvas.CreateBitmapLabel( ChartID (), 0 , "ccanvas" , 0 , 0 , _width, _height, COLOR_FORMAT_ARGB_NORMALIZE ); }
if (! FileIsExist (appName)) { bool isCreated = FolderCreate (appName); if (!isCreated) { Print ( "Error! The folder was not created" ); } } When I run my EA on real data, a folder is created. When I run the EA with same code on the "debug on
datetime dt; /* init dt */ StringFormat ( "datetime = %s;" , TimeToString (dt, TIME_DATE | TIME_SECONDS )); If I use the TimeToString function, I get time in 12-hours format . The output looks like this: datetime = 03 : 35:00 ; First: what I do not like about this output is that I don't know whether
I created a custom struct struct MyStruct { int a; int b; } I want to print a object that is created from this struct void _Print() { Print ( "i = " , i, "b = " , b); } To do it easier I want to overload the Print function and just do like this: MyStruct obj; obj.a = 1 ; obj.b = 2 ; Print (obj); As
struct TickOne { datetime time; double ask; double bid; bool operator >( const TickOne &r) { return this .ask>r.ask; } bool operator <( const TickOne &r) { return this .ask<r.ask; } }; I want to compare two custom objects by using the (<,>) less/more operator. For example: A tickOne, tickOne2