Firestats2 v0.10

Author: Copyright � 2005, TraderSeven
Price Data Components
Series array that contains open time of each bar
Indicators Used
Moving average indicator
Miscellaneous
Uses files from the file systemIt writes information to file
0 Views
0 Downloads
0 Favorites
Firestats2 v0.10
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+-----------------------------------------------------------------------------+
//|                              FireStats v0.5 - Output data for stat analysis |
//+-----------------------------------------------------------------------------+
#property copyright "Copyright © 2005, TraderSeven"
#property link      "TraderSeven@gmx.net"

//----------------------- USER INPUT
extern int MA_length = 4;	 
extern double Percent = 2.0;
extern int RetraceBars =2;


string FileName = "";
FileName=StringConcatenate(Symbol()," - ",MA_length);
Comment(FileName);

//-----

int handle;
double MyUpperMA;
double MyLowerMA;
double MaxPipMove;
int previous1;
int previous2;
int previous3;
int init()

{
handle=FileOpen(FileName, FILE_CSV|FILE_WRITE, ',');
}

//----------------------- MAIN PROGRAM LOOP
int start()
{
// ---------- Lower band
MyLowerMA=iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,RetraceBars)*(1-(Percent/100));
if(MyLowerMA>=Low[RetraceBars])// detect x-over
  {
  MaxPipMove=MyLowerMA-Low[Lowest(NULL,0,MODE_LOW,RetraceBars,0)];
  MaxPipMove=MathCeil(MathAbs(MaxPipMove*10000));
  if(MaxPipMove!=previous1 && MaxPipMove!=previous2 && MaxPipMove!=previous3)
    {
    FileWrite(handle,TimeToStr(CurTime())," - ",MaxPipMove);      
    }
    previous1=previous2;
    previous2=previous3; 
    previous3=MaxPipMove;    
  }

MyUpperMA=iMA(NULL,0,MA_length,0,MODE_SMA,PRICE_OPEN,RetraceBars)*(1+(Percent/100)); 
if(MyUpperMA>=High[RetraceBars])// detect x-over
   {
  MaxPipMove=MyUpperMA-High[Highest(NULL,0,MODE_HIGH,RetraceBars,0)];
  MaxPipMove=MathCeil(MathAbs(MaxPipMove*10000));
  if(MaxPipMove!=previous1 && MaxPipMove!=previous2 && MaxPipMove!=previous3)
    {
    FileWrite(handle,TimeToStr(CurTime())," - ",MaxPipMove);       
    }
    previous1=previous2;
    previous2=previous3; 
    previous3=MaxPipMove;  
    }



}

int deinit()                           
{                                      
   FileClose(handle);
   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 ---