Coding help - page 22

 

thanks for your answer Robert

such a dashboard would be perfect, but i didn't find one with bb squeeze, and i dont have a clue how to change the existing dashboards to detect on bb squeeze

my own idea was very simple it looked like this:

int Current;

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start() {

int USDCHF, GBPUSD, EURUSD, AUDUSD;

double upperBB_USDCHF = iBands("USDCHF", 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, Current + 0);

double upperKC_USDCHF = iCustom("USDCHF", 0, "Keltner Channels", 20, 0, Current + 0);

double lowerBB_USDCHF = iBands("USDCHF", 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, Current + 0);

double lowerKC_USDCHF = iCustom("USDCHF", 0, "Keltner Channels", 20, 2, Current + 0);

if(upperBB_USDCHFlowerKC_USDCHF)

Comment(": BollingerSqueeze for USDCHF");

return(0);

}

//+------------------------------------------------------------------+

thats just for several different pairs then, but as i said the 'Comment' refreshes all the time

edit: ok i fixed it, no help required anymore

 
crexsking:
Hi Mladen n all fellow members,

I trade chart pattern with "big candle move" (Open[0]-Close[0] > 32 pips or vice versa) n i trade eurusd (H1 on FXOpen <--- most accurate candle size n pattern)...

So, there was absolutely no indicators. Just trading philosophy.

i try to code an EA about it logic but i think something missing there... please help!!!

Whats "something missing" that i means:

-i want before the "big candle" happen... the system calculated last 4 candles < 20pips (open - close or vice versa) for every candle.

Whereas.. what happened is my mql4 coding does not read the last 4 candles before big candle... im so confiused..

What should happen is:

1. Time for Big Candle :-

- 3pm,4pm,5pm(London Open) ..n.. 8pm,9pm,10pm(US Open) <---- all time given as i malaysian, so switch ur computer to GMT 8.00++

2. Big Candle size :-

- 32 pips n above ( if sideway before are 20 pips n below )

- 42 pips n above ( if sideway before are 20 pips n above )

3. Sideway market :-

- below 50 pips for last minimum 4 hours n must have different colour.

4. Void or dangerous Market (market cancel): <--- no trade if this market condition happen

1. Sideway before London Open B,B,B,B upward or S,S,S,S downward. <--- B,B,B,B = Candles Buy,buy,buy,buy... continuously

2. Big candle close at daily zon maximum. <---- 75 pips minimum high low

3. Big candle occur at 10 pm. <----- GMT 8++ or Malaysia time

4. Big candle too large and more than 80 pips.

5. There are candle more than 50 pips before the London open.

6. The form of an upward market in Tokyo session and big candle upward in London open (vice versa for downward)

The coding problems attach :-

extern double trigger = 32;

extern double sideway = 20;

extern int hour1 = 6;

extern int hour2 = 7;

extern int hour3 = 8;

extern int hour4 = 9;

extern int hourCB = 10;

extern int hourTRADE = 11;

extern int TradeTimeStart = 0;

extern int TradeTimeEnd = 23;

//---Variables

double currentPrice = 0.00000;

static datetime barStart;

string openTrades = "none";

int ticket;

int i = 0;

double lotSize;

double CBB = 0;

double CBS = 0;

double CBBT;

double CBST;

double PreviousCBB;

double PreviousCBS;

double CS1B;

double CS2B;

double CS3B;

double CS4B;

double CS5B;

double CS6B;

double CS1S;

double CS2S;

double CS3S;

double CS4S;

double CS5S;

double CS6S;

double CS1BT;

double CS2BT;

double CS3BT;

double CS4BT;

double CS1ST;

double CS2ST;

double CS3ST;

double CS4ST;

double PreviousCS1B;

double PreviousCS2B;

double PreviousCS3B;

double PreviousCS4B;

double PreviousCS1S;

double PreviousCS2S;

double PreviousCS3S;

double PreviousCS4S;

double GroupSW1B;

double GroupSW2B;

double GroupSW3B;

double GroupSW4B;

double GroupSW5B;

double GroupSW6B;

double GroupSW1S;

double GroupSW2S;

double GroupSW3S;

double GroupSW4S;

double GroupSW5S;

double GroupSW6S;

string permit = "suspended";

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start(){

CBB=(Close[1]-Open[1])/Point;

CBS=(Open[1]-Close[1])/Point;

CBBT=(hourCB==Hour());

CBST=(hourCB==Hour());

PreviousCBB = (CBB == CBBT);

PreviousCBS = (CBS == CBST);

CS1B=(Close[7]-Open[7])/Point;

CS2B=(Close[6]-Open[6])/Point;

CS3B=(Close[5]-Open[5])/Point;

CS4B=(Close[4]-Open[4])/Point;

CS5B=(Close[3]-Open[3])/Point;

CS6B=(Close[2]-Open[2])/Point;

CS1S=(Open[7]-Close[7])/Point;

CS2S=(Open[6]-Close[6])/Point;

CS3S=(Open[5]-Close[5])/Point;

CS4S=(Open[4]-Close[4])/Point;

CS5S=(Open[3]-Close[3])/Point;

CS6S=(Open[2]-Close[2])/Point;

CS1BT=(hour1==Hour());

CS2BT=(hour2==Hour());

CS3BT=(hour3==Hour());

CS4BT=(hour4==Hour());

CS1ST=(hour1==Hour());

CS2ST=(hour2==Hour());

CS3ST=(hour3==Hour());

CS4ST=(hour4==Hour());

PreviousCS1B = (CS1B == CS1BT);

PreviousCS2B = (CS2B == CS2BT);

PreviousCS3B = (CS3B == CS3BT);

PreviousCS4B = (CS4B == CS4BT);

PreviousCS1S = (CS1S == CS1ST);

PreviousCS2S = (CS2S == CS2ST);

PreviousCS3S = (CS3S == CS3ST);

PreviousCS4S = (CS4S == CS4ST);

GroupSW1B = (CS3B<sideway&&CS4S<sideway&&CS5B<sideway&&CS6S=trigger);

GroupSW1S = (CS3S<sideway&&CS4B<sideway&&CS5S<sideway&&CS6B=trigger);

currentPrice = iClose(NULL,0,0);

Comment("Price Continuation\n",

"Status: ",status()

);

//----Trade Algorithm

//trade hours value...

if(TradeTimeStart <= Hour() && Hour() <= TradeTimeEnd){

if(openTrades == "none" && permit == "approved"){

requestLongOrder();

requestShortOrder();

}

else{

requestPermit();

}

}

if(openTrades == "long"){

manageLongTrade();

}

if(openTrades == "short"){

manageShortTrade();

}

return(0);

}

//---FUNCTIONS---

//--

void requestLongOrder(){

if(hourTRADE==Hour() && GroupSW1B){

//--

Lots = CalcLots ();

ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,3,currentPrice-stopLoss,currentPrice+takeProfit,"My order ",06010,0,Green);

if(ticket<0){

//add email/sms alert here with GetLastError();

}

if(ticket>0){

openTrades = "long";

permit = "suspended";

}

}

}

void requestShortOrder(){

if(hourTRADE==Hour() && GroupSW1S){

//--

Lots = CalcLots ();

ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,currentPrice+stopLoss,currentPrice-takeProfit,"My order ",06010,0,Red);

if(ticket<0){

//add email/sms alert here with GetLastError();

}

if(ticket>0){

openTrades = "short";

permit = "suspended";

}

}

}

* what should happen as screen shot attached.

Please help...

Thanks...

Regards,

crexsking

Hi Crexsking,

Only thing i can think of is you may need to convert for 5 digit broker, after start put something like this

double pipMultiplier = 1; (before init)

int start()

{

if (Digits==3 || Digits==5)

pipMultiplier = 10;

else pipMultiplier = 1;

And then after every Point something like this Point*pipMultiplier.

 

How Comments Were Solved?

Deorn:
thanks for your answer Robert

such a dashboard would be perfect, but i didn't find one with bb squeeze, and i dont have a clue how to change the existing dashboards to detect on bb squeeze

my own idea was very simple it looked like this:

========

thats just for several different pairs then, but as i said the 'Comment' refreshes all the time

edit: ok i fixed it, no help required anymore

Hi Deorn,

Great to hear you solved your challenge. Care to share what you did to correct the "comment" refreshing...?

Have fun with your coding...!

Robert

 
cosmiclifeform:
Hi Deorn,

Great to hear you solved your challenge. Care to share what you did to correct the "comment" refreshing...?

Have fun with your coding...!

Robert

I made it with 'objectcreate' as you said

I realised it for the timeframes M5 to monthly in 10 different pairs:

Keltner Channels are required with the exact name 'Keltner Channels', i choose the settings 20 with Factor 1.5

both are two normal indicators

I would choose a blank window to put it in

and sorry for ugly programming it's my first own indicator, but it does the job

greets

 
mrtools:
Hi Crexsking,

Only thing i can think of is you may need to convert for 5 digit broker, after start put something like this

double pipMultiplier = 1; (before init)

int start()

{

if (Digits==3 || Digits==5)

pipMultiplier = 10;

else pipMultiplier = 1;

And then after every Point something like this Point*pipMultiplier.

Hi mrtools n thanks...

I will do it but before that can i ask.. what is the relation to convert it with 5 digit brokers?

I mean... before this, the system can't recognize bull or bear candle in last 4 candles of sideway market.

If I put this code, the system will recognize it?

Sorry for my poor english...

regards,

crexsking

 
crexsking:
Hi mrtools n thanks...

I will do it but before that can i ask.. what is the relation to convert it with 5 digit brokers?

I mean... before this, the system can't recognize bull or bear candle in last 4 candles of sideway market.

If I put this code, the system will recognize it?

Sorry for my poor english...

regards,

crexsking

Crexsking, it will bring it to pips so if for instance you have .91135 for open and .90685 for close the difference is .0045 if you are on 5 digit broker point would equal 450 because its divided by .00001 but if you use the conversion it correctly make it 45 pips, because you are then dividing by .0001 or .00001 x 10.And as far as recognizing bull or bear candle really can't say because i don't see anything else wrong with your code.

 

Big Player's Coding.. help please...

\\---- Edited

Ok done...

Problem solved.

regards,

crexsking

 

Need Help

Hello for all master coding, I need your help please :

What about coding it if I want to create horizontal lines the upper and lower bounds on the group of the candle (close - open) is small in value. Value (close - open)*100000 = without polarity and always positive. My candle number of external content.

Example:

extern int (close - open)*100000 = 10; // Its mean (close - open) <= 10

extern int Number of candle maximum = 3;

"Horizontal line upper limit" = taken from the highest open/close inherent in the group

"Horizontal line lower limit" = taken from the highest open/close inherent in the group

My best regards,

Thank you

Files:
 

...

I am afraid I do not understand exactly what you mean. so answering just a part of your question.

If you multiply the difference of a 5 digit symbol on a 5 digit broker with 100000 then ypu are going to get the desired value but if the symbol is for example one of the JPY crosses you are going to get values that exceed those values by far. Also, on a 4 digit brokers you are going to have bigger values too. To prevent that the best way is to calculate difference in pips. This is the way how you can do that :
double pipMultiplier = 1;

if (Digits==3 || Digits==5) pipMultiplier = 10;

//

//

// calculate the difference in pips

//

//

double difference = MathAbs((Close[shift] - Open[shift])/(Point*pipMultiplier));[/PHP]

And it will always be in pips regardless of the symbol or broker

As of minimum and maximum you can find out a lowest low and highest high values of a range of bars with a code like this (this example is set to look in a range of 3 bars as you are talking about it) :
[PHP]double highest = High;

double lowest = Low;

paijowijaya:
Hello for all master coding, I need your help please :

What about coding it if I want to create horizontal lines the upper and lower bounds on the group of the candle (close - open) is small in value. Value (close - open)*100000 = without polarity and always positive. My candle number of external content.

Example:

extern int (close - open)*100000 = 10; // Its mean (close - open) <= 10

extern int Number of candle maximum = 3;

"Horizontal line upper limit" = taken from the highest open/close inherent in the group

"Horizontal line lower limit" = taken from the highest open/close inherent in the group

My best regards,

Thank you
 
mladen:
I am afraid I do not understand exactly what you mean. so answering just a part of your question. If you multiply the difference of a 5 digit symbol on a 5 digit broker with 100000 then ypu are going to get the desired value but if the symbol is for example one of the JPY crosses you are going to get values that exceed those values by far. Also, on a 4 digit brokers you are going to have bigger values too. To prevent that the best way is to calculate difference in pips. This is the way how you can do that :
double pipMultiplier = 1;

if (Digits==3 || Digits==5) pipMultiplier = 10;

// calculate the difference in pips

double difference = MathAbs((Close[shift] - Open[shift])/(Point*pipMultiplier));[/PHP]

:
[PHP]double highest = High;

double lowest = Low;

Big surprise I am very happy that you responds to my question Master Mladen,

But sorry I am still confused, would you give complete coding? Value * 100000 I meant to be easy in the readings, not 0.0002 (4 digits behind the comma), but if you have an easier way, I will follow your way. In essence, when found three candles (the balance zone or buyers = sellers or side way zone, each TF its different number of candles) which is small (its value is taken from the difference between Close - Open) I want to draw a horizontal line just as the picture I've uploaded. So I know the supply and demand in the chart with the help of the line. Or is there such an indicator that you have?

My Best Regards,

Thank you Master Mladen

Reason: