Coding help - page 387

 

This script allows us to drag our stop loss and take profit lines on chart. It's a really nice tool to have for us day traders who like to manually close trades or move stop loss using price action. (At least I think so.) Can someone please check this script to see if it works on latest MT4 build and update if not. I'd be really appreciative.

Thanks,

jbozman

Files:
dragsltp.mq4  19 kb
 
jbozman:
This script allows us to drag our stop loss and take profit lines on chart. It's a really nice tool to have for us day traders who like to manually close trades or move stop loss using price action. (At least I think so.) Can someone please check this script to see if it works on latest MT4 build and update if not. I'd be really appreciative.

Thanks,

jbozman

Hi,

Corrected with no error compiling.

Seems to work ok.

Test it please.

Have a good trading week.

Tomcat98

Files:
 

Thank you so much. I will test out.

jbozman

 

This indicator places colored zones on the chart to coincide with the various sessions.

2 things:

1) Can someone please check to make sure it's compatible with latest build of MT4.

2) It might be in the code already, but not sure if it's compatible with latest build...that being, I would like all the boxes/highlighted zones to appear at the new day starting at 0 GMT. So if I have a colored zone to appear at the start time of 8 GMT and going until 14:00 GMT, I would like that zone to appear on the chart starting at 0 GMT...same for any of the settings. Have all these zones appear at 0 GMT.

As I said, it might be in the code; however, I want to make sure it's compatible if it is.

Thanks so much!

jbozman

Files:
 
jbozman:
This indicator places colored zones on the chart to coincide with the various sessions.

2 things:

1) Can someone please check to make sure it's compatible with latest build of MT4.

2) It might be in the code already, but not sure if it's compatible with latest build...that being, I would like all the boxes/highlighted zones to appear at the new day starting at 0 GMT. So if I have a colored zone to appear at the start time of 8 GMT and going until 14:00 GMT, I would like that zone to appear on the chart starting at 0 GMT...same for any of the settings. Have all these zones appear at 0 GMT.

As I said, it might be in the code; however, I want to make sure it's compatible if it is.

Thanks so much!

jbozman

jbozman

There is no need to change anything in that indicator. It is already new metatrader 4 compatible

 
mladen:
jbozman There is no need to change anything in that indicator. It is already new metatrader 4 compatible

Mladen, I goofed. I sent you the wrong indicator.

I use this lines indicator, not the rectangles zone indicator to mark the sessions. The zones got too confusing with the color. I hope it's not too much to ask to check this one instead. This is the one that has errors when I compile. Please forgive.

jbozman

*Edit post...has 1 warning...not error. Something about control paths not all returning a value.

 
jbozman:
Mladen, I goofed. I sent you the wrong indicator.

I use this lines indicator, not the rectangles zone indicator to mark the sessions. The zones got too confusing with the color. I hope it's not too much to ask to check this one instead. This is the one that has errors when I compile. Please forgive.

jbozman

*Edit post...has 1 warning...not error. Something about control paths not all returning a value.

Try out this one : vertical_lines_v1.1.mq4

Did not test the time shift (use TimeAdjustHours to set time shift)

Files:
 

Dear coders, is there an easy way to increase the lot size based on balance? For example, let's say I want to trade lot 1 for every 10000 units of balance, or if I want to do 0.02 for every 1000 units of balance? Which parameters would I need and what would be the code?

In the first example, I would be in lot 1 for 10000 <= balance <= 19000, and lot 2 for 20000 <= balance <= 29000, etc.

Thank you.

 
mladen:
Try out this one : vertical_lines_v1.1.mq4 Did not test the time shift (use TimeAdjustHours to set time shift)

Thanks Mladen. You know, I don't even use that...however, now that you bring it up, maybe I would make use of it. Is it to use for daylight savings or is that used for broker time?

 
madopter:
Dear coders, is there an easy way to increase the lot size based on balance? For example, let's say I want to trade lot 1 for every 10000 units of balance, or if I want to do 0.02 for every 1000 units of balance? Which parameters would I need and what would be the code?

In the first example, I would be in lot 1 for 10000 <= balance <= 19000, and lot 2 for 20000 <= balance <= 29000, etc.

Thank you.

You can do that like this

double lots=5; // or whatever maximal lot size you chose

while (true)

{

if (AccountBalance()<19000) { lots = 1; break; }

if (AccountBalance()<29000) { lots = 2; break; }

if (AccountBalance()<39000) { lots = 3; break; }

//

//

// futher comparisons here in ascending order

//

//

break;

}

Reason: