test4_5ticks

Author: Ron T
Orders Execution
It automatically opens orders when conditions are reached
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
test4_5ticks
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|Simple counter-indicated trader for AUD/USD                       |
//+------------------------------------------------------------------+
#property copyright "Ron T"
#property link      "http://www.lightpatch.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 DeepSkyBlue

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|

int init()
  {

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexArrow(0,234); //down red
   
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexArrow(1,233); //up white

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexBuffer(2, ExtMapBuffer2);
   SetIndexArrow(2,159); //dot blue

   return(0);
  }


//+------------------------------------------------------------------+
//| Cursor indicator deinit                                          |
//+------------------------------------------------------------------+
int deinit()
  {
   int i;
   
   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;

   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double curTYP=0;
   double oldTYP=0;
   double xxxTYP=0;
   double change=0;
   int    ticket=1;
   
         
   Print ("tick at ",CurTime());

   //trades no more often than once an hour + 1 minute 
   if(CurTime()-OrderOpenTime()<3660) return(0);
 
   xxxTYP=(High[3]+Low[3]+Close[3])/3;
   ExtMapBuffer3[3]=xxxTYP;


   oldTYP=(High[2]+Low[2]+Close[2])/3;
   curTYP=(High[1]+Low[1]+Close[1])/3;
       

   change=curTYP-oldTYP;
      
   // buffer1 Red    down
   if ( change < -0.0005 )
     {
      ExtMapBuffer1[1]=curTYP;
      ExtMapBuffer2[2]=0;
      
      ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,0,Ask-10*Point,Ask+10*Point,"ASD/USD BUY  order",525125,0,Green);
      if(ticket<0)
        {
         Print("OrderSend BUY  failed with error #",GetLastError());
         return(0);
        }
     }
       
   // buffer2 White  up
   if ( change > 0.0005 )
     {
      ExtMapBuffer1[1]=0;
      ExtMapBuffer2[2]=curTYP;

      ticket=OrderSend(Symbol(),OP_SELL,0.1,Ask,0,Ask+10*Point,Ask-10*Point,"ASD/USD SELL order",525525,0,Red);
      if(ticket<0)
        {
         Print("OrderSend SELL failed with error #",GetLastError());
         return(0);
        }
     }
          
   return(0);
  }
 

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---